Skip to content

Commit

Permalink
[playframework#1309] Include explicit query paramters that are also i…
Browse files Browse the repository at this point in the history
…n routeArgs
  • Loading branch information
colesbury authored and mbknor committed Mar 14, 2012
1 parent 1e76061 commit 8492a0b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion framework/src/play/mvc/Router.java
Expand Up @@ -491,7 +491,7 @@ public static ActionDefinition reverse(String action, Map<String, Object> args)
}
} else if (route.staticArgs.containsKey(key)) {
// Do nothing -> The key is static
} else if (Scope.RouteArgs.current() != null && Scope.RouteArgs.current().data.containsKey(key)) {
} else if (!argsbackup.containsKey(key)) {
// Do nothing -> The key is provided in RouteArgs and not used (see #447)
} else if (value != null) {
if (List.class.isAssignableFrom(value.getClass())) {
Expand Down
Expand Up @@ -152,6 +152,10 @@ public static void optional() {
renderText("OK");
}

public static void withQueryParam(String lucky) {
renderText("OK");
}

public static void reverserouting() {
render("Application/reverse.html");
}
Expand Down
Expand Up @@ -8,4 +8,6 @@
<div id="f">@{Application.aGetForm2()}</div>
<div id="g">@{Application.aGetForm('Yop')}</div>
<div id="h">@{Application.aGetForm2('Yop')}</div>
<div id="i">@{Application.optional()}</div>
<div id="i">@{Application.optional()}</div>
<div id="j">@{Application.withQueryParam()}</div>
<div id="k">@{Application.withQueryParam("duck")}</div>
1 change: 1 addition & 0 deletions samples-and-tests/just-test-cases/conf/routes
Expand Up @@ -14,6 +14,7 @@ GET /re/{<[0-9]{5}>re} Application.ok
GET /re/{<[A-Z]{2,4}>re} Application.ok

GET /{lucky}/doIt Application.showIt
GET /withQueryParam Application.withQueryParam

GET www.zenexity.com/hello Application.helloZen
GET /st%C3%A9phane Application.helloSteph
Expand Down
2 changes: 2 additions & 0 deletions samples-and-tests/just-test-cases/test/routing.test.html
Expand Up @@ -111,6 +111,8 @@
assertText('g', '/aGetForm?name=Yop')
assertText('h', '/aGetForm/?name=Yop')
assertText('i', '/optionalSlash')
assertText('j', '/withQueryParam')
assertText('k', '/withQueryParam?lucky=duck')

// Reverse
open('@{Application.reverserouting2()}')
Expand Down

0 comments on commit 8492a0b

Please sign in to comment.