issues with Boolean values in routes

1,017 views
Skip to first unread message

Daniel Berndt

unread,
Mar 12, 2012, 12:20:34 PM3/12/12
to play-fr...@googlegroups.com
Assuming the routes-file looks like this:

GET     /bool/:value                controllers.Application.boolPage(value: Boolean)
GET     /bool                       controllers.Application.boolPageImplicit(value: Boolean)

then reverse routing results in the following urls (for true and false respectively):

/bool/value=1  -  /bool/value=0
/bool?value=1  -  /bool?value=0

in case of the first line, play does not recognise the url and raises a 404
in the second case, more interestingly, it returns literally nothing: 
(Chrome tells me: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.)

This smells pretty much like a bug.

Julien Richard-Foy

unread,
Mar 12, 2012, 12:57:04 PM3/12/12
to play-fr...@googlegroups.com
I think so, I filled a ticked.

Julien Richard-Foy

unread,
Mar 12, 2012, 2:12:59 PM3/12/12
to play-fr...@googlegroups.com
I was unable to reproduce the issue with the second case, what does
your action code look like?

Daniel Berndt

unread,
Apr 20, 2012, 1:03:10 PM4/20/12
to play-fr...@googlegroups.com
Sorry for the late reply.

My controller took a "Boolean" instead of a "boolean".
I just checked it with the most recent play-code and Error 324 still occurs when using "Boolean"

MG

unread,
Apr 23, 2012, 7:34:25 PM4/23/12
to play-fr...@googlegroups.com
I ran into the same bug. When the reverse router is called with a Boolean parameter, it inserts both the name of variable (as defined in the routes file) and its value. For example, for the route:

POST     /page/:isNew                            controllers.MyPage.submit(isNew: Boolean)

when I use routes.MyPage.submit(true) as the action in a form, it generates the following:

<form action="/page/isNew=1" method="POST" > instead of
<form action="/page/1" method="POST" >
--MG

Julien Richard-Foy

unread,
Apr 24, 2012, 3:48:28 AM4/24/12
to play-fr...@googlegroups.com
This bug should have been fixed on master, are you using master?

MG

unread,
Apr 30, 2012, 10:38:54 AM4/30/12
to play-fr...@googlegroups.com
Sorry for the late reply. I am not using the Master. I am using the final 2.0 release.

-MG

Jay Park

unread,
Aug 5, 2012, 11:48:03 PM8/5/12
to play-fr...@googlegroups.com
Hello, 

I'm getting the same issue but not with boolean type. I think it's about routes & controller mapping issue but I'm not sure. 
When this happens, I don't see error message or logs. 
What causes this?

Cheers,
Jay
Reply all
Reply to author
Forward
0 new messages