| Author |
How to manually parse query args?
|
Jake Beard
Greenhorn
Joined: Oct 06, 2009
Posts: 6
|
|
Hi all,
I was puzzled for a while as to why Tomcat does not seem to parse the query string in in the PUT data of the doPut method on my servlet. The effect of this is that it doesn't populate parameterMap in doPut. I found the answer on Stack Overflow:
http://stackoverflow.com/questions/855835/servlet-parameters-and-doput
My question now is, once I retrieve the PUT data into a string, how can I manually parse the query arguments into name-value pairs? It would be fairly easy to write this code myself, but this seems like such an easy, obvious thing to be able to do, I don't want to duplicate work that has likely already been done. This method is almost certainly to be found inside of Tomcat, but it may not be publicly exposed, and I can't seem to find it.
Please let me know what you think. Thanks,
Jake
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
I wouldn't use a Tomcat-proprietary method even if it were made public. Ties you to a a particular container, and that's a poor practice indeed.
I don't know of any available APIs that you can use, but perhaps there might be one somewhere in the Jakarta Commons project set. Personally, I'd just write a simple method to do it myself.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Jake Beard
Greenhorn
Joined: Oct 06, 2009
Posts: 6
|
|
Bear Bibeault wrote:I wouldn't use a Tomcat-proprietary method even if it were made public. Ties you to a a particular container, and that's a poor practice indeed.
I don't know of any available APIs that you can use, but perhaps there might be one somewhere in the Jakarta Commons project set. Personally, I'd just write a simple method to do it myself.
I used the parse code here:
http://www.apl.jhu.edu/~hall/java/CGI-with-Java.html
Works quite well,
Jake
|
 |
 |
|
|
subject: How to manually parse query args?
|
|
|