Grails JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
Grails
  • Grails
  • GRAILS-9888 REST and URL mapping changes
  • GRAILS-8945

Support reverse lookup of REST URL mappings

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.1
  • Fix Version/s: None
  • Component/s: TagLib, URL mappings
  • Labels:
    None

Description

Reverse lookup for a mapping like this:

"/api/books"(controller: "book") {
    action = [GET: "apiShow", POST: "apiNew"]
}

doesn't work if you provide an 'action' attribute to any of the link generation tags. It only works if you leave 'action' out. This is pretty confusing, so it would be good if createLink(controller: "book", action: "apiNew") generated "/api/books".

To demonstrate the issue, unpack the attached bug report, run the application, and open the home page. The two "API ..." links displayed on the page link to a different location than "/api/books".

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    url-mapping-changes-bug-report-23032012.zip
    23/Mar/12 4:56 AM
    26 kB
    Peter Ledbrook
    1. File
      grails-app/conf/.UrlMappings.groovy.swp 12 kB
    2. File
      grails-app/.../ApplicationResources.groovy 0.1 kB
    3. File
      grails-app/conf/BootStrap.groovy 0.4 kB
    4. File
      grails-app/conf/BuildConfig.groovy 2 kB
    5. File
      grails-app/conf/Config.groovy 4 kB
    6. File
      grails-app/conf/DataSource.groovy 1 kB
    7. File
      grails-app/conf/UrlMappings.groovy 1 kB
    8. File
      grails-app/conf/spring/resources.groovy 0.0 kB
    9. File
      grails-app/.../BookController.groovy 0.2 kB
    10. File
      grails-app/.../ErrorController.groovy 0.1 kB
    11. File
      grails-app/.../RepositoryController.groovy 0.2 kB
    12. File
      grails-app/.../SomeController.groovy 0.2 kB
    13. File
      grails-app/.../TestController.groovy 0.2 kB
    14. File
      grails-app/domain/.../example/Book.groovy 0.2 kB
    15. File
      grails-app/i18n/messages.properties 3 kB
    16. File
      grails-app/.../messages_cs_CZ.properties 3 kB
    17. File
      grails-app/i18n/messages_da.properties 3 kB
    18. File
      grails-app/i18n/messages_de.properties 4 kB
    19. File
      grails-app/i18n/messages_es.properties 3 kB
    20. File
      grails-app/i18n/messages_fr.properties 2 kB
    21. File
      grails-app/i18n/messages_it.properties 2 kB
    22. File
      grails-app/i18n/messages_ja.properties 4 kB
    23. File
      grails-app/i18n/messages_nl.properties 3 kB
    24. File
      grails-app/.../messages_pt_BR.properties 3 kB
    25. File
      grails-app/.../messages_pt_PT.properties 3 kB
    26. File
      grails-app/i18n/messages_ru.properties 4 kB
    27. File
      grails-app/i18n/messages_sv.properties 3 kB
    28. File
      grails-app/i18n/messages_th.properties 6 kB
    29. File
      grails-app/.../messages_zh_CN.properties 2 kB
    30. File
      grails-app/views/error.gsp 0.3 kB
    Showing 30 of 38 items Download Zip
    Show
    Zip Archive
    url-mapping-changes-bug-report-23032012.zip
    23/Mar/12 4:56 AM
    26 kB
    Peter Ledbrook

Issue Links

is related to

Sub-task - The sub-task of the issue GRAILS-9326 default controller name not applied, custom mapping in URLMappings applied

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Sub-task - The sub-task of the issue GRAILS-2843 Form tag doesn't generate correct URL when REST-ful HTTP protocol is used

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Open - The issue is open and ready for the assignee to start work on it.

Bug - A problem which impairs or prevents the functions of the product. GRAILS-4588 reverse URL mapping breaks in controllers with alternate REST mappings

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.
relates to

Sub-task - The sub-task of the issue GRAILS-2843 Form tag doesn't generate correct URL when REST-ful HTTP protocol is used

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Open - The issue is open and ready for the assignee to start work on it.

Bug - A problem which impairs or prevents the functions of the product. GRAILS-5207 Reverse URL mappings / redirect to REST url mapping fails

  • Blocker - Blocks development and/or testing work, production could not run.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Git Commits
Hide
Permalink
Rick Jensen added a comment - 12/Apr/12 8:24 AM

GRAILS-2843 is a specific instance of this, or is at least closely related.

Show
Rick Jensen added a comment - 12/Apr/12 8:24 AM GRAILS-2843 is a specific instance of this, or is at least closely related.
Hide
Permalink
Iván López added a comment - 04/May/13 12:37 AM

I think the main problem here is because grails "enforces you" in some way to use createLink, redirect,... using controller/action values instead of using named URLs.
I think that the default use should be creating a named URL and use it in all the application. There are only advantages:

  • Easy refactors for controllers. It is only necessary to change the action in the URL mappings file and not in all controllers and GSPs.
  • Write less code. You only write createLink(mapping:'myMapping') instead of createLink (controller:'myController',action:'myAction')

As a final thought, in all our grails project we always use named URLs because we have leant from our previous errors in others projects.

Show
Iván López added a comment - 04/May/13 12:37 AM I think the main problem here is because grails "enforces you" in some way to use createLink, redirect,... using controller/action values instead of using named URLs. I think that the default use should be creating a named URL and use it in all the application. There are only advantages: Easy refactors for controllers. It is only necessary to change the action in the URL mappings file and not in all controllers and GSPs. Write less code. You only write createLink(mapping:'myMapping') instead of createLink (controller:'myController',action:'myAction') As a final thought, in all our grails project we always use named URLs because we have leant from our previous errors in others projects.

People

  • Assignee:
    Unassigned
    Reporter:
    Peter Ledbrook
Vote (2)
Watch (2)

Dates

  • Created:
    23/Mar/12 4:56 AM
    Updated:
    04/May/13 12:37 AM
    Last Reviewed:
    12/Apr/12

Agile

  • View on Board
  • Atlassian JIRA (v5.2.1#813-sha1:277a546)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Grails project. Try JIRA - bug tracking software for your team.