ChristopherSchultz commented on issue #232: Fix handling of query parameters 
with no value, like `?foo`
URL: https://github.com/apache/tomcat/pull/232#issuecomment-573438973
 
 
   > I think `?foo&foo=1&foo` leading to `{null, "1", null}` is totally valid 
and imho the expected behavior.
   
   Thanks for the original comment about this @panchenko. I think this should 
return `{"", "1", ""}` to be consistent with the other methods. That means that 
`?foo` should not return `new String[0]` but instead `new String[] { "" }`.
   
   > Asking for a parameter's value `getParameter(String)` should return its 
value.
   > Doing so for a Parameter, that was not provided has no defined behavior to 
my mind.
   
   The only way to tell the difference between the parameter being present and 
not is to check the value you get back from `getParameter`. Returning `null` is 
indistinguishable from the parameter not being present, so `null` is not 
acceptable.
   
   > Therefore I advocate for a `isParameter(String)` or similar method that 
checks if a parameter was provided at all.
   
   You cannot change the servlet API, so this is not possible. Also, it has to 
be backward-compatible, so, again, this cannot be changed.
   
   I am now officially a -1 on this PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to