I cant seem to get multiple parameters to work if i add one parameter everything is fine as soon as i add a second parameter i always get a
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
Can anyone else confirm that you can add a second param to a request using play 2.0.2? (using java)
My url is as simple as this
http://localhost:9000/account/foruser?username=somethig&create=0
and the routes
GET /account/foruser
controllers.user.UserController.foruser(username:String, create:Boolean )
You should put some more attention on the routes docs and samples
In general if you're using named params with &name=value
you don't need to specify them in the routes files. Instead use DynamicForm in the Java to access them.
Route file is used for matching unnamed
parts of the link with controler's action and params. So your link should look like:
http://localhost:9000/account/foruser/something/0
and route (of course this need to be placed in one line in routes file:
GET /account/foruser/:username/:create
controllers.user.UserController.foruser(username: String, create: Integer )
Note that was some bug reports on using the Boolean type in the route, so it's just safer to use some numeric type instead.
@biesior I am getting the same problem using 2.0.4 with two types of parameters
File routes:
GET /v2/object/all/data/:from/:until/:all controllers.ObjectController.getAllData(from: String, until: String , all: Boolean, username: String ?= null, password: String ?=null)
File controller:
public static Result getAllData(
@PathParam("from") String from,
@PathParam("until") String until,
@PathParam("all") Boolean all,
@QueryParam("username") String username, @QueryParam("password") String password)
After doing several tests I finally solved the problem. You should use "boolean" instead of Boolean, so "getAllData" transforms to:
public static Result getAllData(
@PathParam("from") String from,
@PathParam("until") String until,
@PathParam("all") boolean all,
@QueryParam("username") String username, @QueryParam("password") String password)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With