Reputation: 49095
Apparently the order of request parameters is not preserved in the Tomcat servlet container (per google it seems other containers share the same problem).
This seems very wrong.
How would one restore the actual order of request parameters from a HttpServletRequest?
EDIT BTW for those that think order for request parameters does not matter there is a difference between:
http://blah?a=1&a=2
and
http://blah?a=2&a=1
So order does matter for duplicate request parameters (luckily Java does handle this right).
Upvotes: 1
Views: 2898
Reputation: 6179
You likely could use the getRequestURL: http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURL() and from there parse out the parameters.
BUT, in reply to your comment "This seems very wrong.", I think you should rethink your stance.
Ordering your parameters simply doesn't make sense. Lets say - for example - you were asking for a list of cars based on parameters. It shouldn't matter if you're asking for a list of fords that are green or a list of green cars that are fords.
Upvotes: 0
Reputation: 597324
Normally you should not depend on the order of parameters. If you are really sure this is necessary, you can:
request.getQueryString()
to see GET
parametersrequest.getInputStream()
) and read the submitted POST
params.Upvotes: 3