Grails

Reverse URL mapping incorrectly URL encodes URL tokens

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: 1.0.2
  • Component/s: TagLib
  • Labels:
    None

Description

Using the following mapping for my example:

public class CustomUrlMappings {
static mappings = {
"/$mslug/$controller/$action/$id?" {
}
}
}

...and the following url:

http://localhost:8080/appname/acme/product/list

Here are the <g:link> examples and results (none of which work correctly)

1) This is the example from the docs, but it treats the url token as a standard query param.

<g:link controller="product" action="create" params="[mslug:params.mslug]">New Product</g:link>
http://localhost:8080/appname/product/create?mslug=acme

2) Looks to have had the slash escaped.

<g:link url="[controller:params.mslug+'/product',action:'create']">New Product</g:link>
http://localhost:8080/appname/acme%2Fproduct/create

3) Same result as #2

<g:link controller="${params.mslug}/product" action="create">New Product</g:link>
http://localhost:8080/appname/acme%2Fproduct/create

4) Trying something different...close but not right.

<g:link url="${params.mslug}" action="create">New Product</g:link>
http://localhost:8080/appname/acme/product/acme

5) Same as #4.
<g:link url="${params.mslug}">New Product</g:link>
http://localhost:8080/appname/acme/product/acme

Issue Links

Activity

Hide
Graeme Rocher added a comment -

number 1) works now, number 2 and 3 are invalid. You cannot include slashes in the action and controller names

Show
Graeme Rocher added a comment - number 1) works now, number 2 and 3 are invalid. You cannot include slashes in the action and controller names
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: