mbw
mbw

Reputation: 23

urlmappings changes - grails 2 to 3 upgrade

I have the following mapping in my UrlMappings.groovy:

"/$controller/$action?/$id?/$id2?/$id3?" {constraints {}}

Given a request url xcontroller/xaction/xid1//xid3 ( note // )

grails 2.x would produce values for id and id3 but not id2. this is what i would have expected.

In grails 3.2.5, this url only produces id1 and id2 values ( xid3 becomes id2 ). It appears the // is ignored.

Have others experienced this issue? Is it a bug or desired change?

Upvotes: 0

Views: 44

Answers (1)

jja
jja

Reputation: 100

I consider the old behavior a bug and the new behavior as preferred. Empty path segements like // should get resolved to nothing, and further all of the following URLs should be equivalent:

http://host/foo/bar
http://host/foo//bar
http://host/foo/./bar

RFC3986 discusses URI syntax.

You could use a dummy value like 0 as a placeholder for "missing" components.

Upvotes: 1

Related Questions