in asp there's request.form and request.queryString attributes, but in java it seems like we have only one collection, which can be accessed via request.getParamaterMap, getParametersNames, getParameterValues, etc...
is there some way to tell which values have been posted nd which ones have been specified in the url?
--
ps:
what I'm trying to achieve is to make a page that can handle the following situation
read the variables that came from the querystring (get) read a single post with a certain name ( "xml", for example )
if that post is missing, read the whole body (with the request.getReader())...
-- I'm using tomcat 6...
according to what I've seen so far, if I issue a request.getReader(), posted values no longer appears in the getParamater collection, nevertheless querystring parameters are still there...
On the other hand, if I issue any of the getParameters methods, getReader returns empty string... :-(
seems like I can't have the cake and eat it too...
so, I guess the solution is the folowwing:
read the body with getReader...
see if the xml post is there (downside, I have to manually parse the body :-( )
if it is, get the http message body and get rid of the "xml=" part...
if it's not, well, just get the body
read the querystring parameters thru request.getParameter....
any better idea?
ps: does anybody knows how to parse the body using the same method used by HttpServlet??? ps2: here is a decoding asp function... shall I just rewrite it in java... http://www.aspnut.com/reference/encoding.asp ps3: also found http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html (don't have a machine to test it right now)
--
just to clarify things... the problem seems to be that with getParameter you get posted values as well as values passed with the url, consider the following example:
" ); } } %> param test
the output of this code is
data:from_get data:from_post
...
seems like in order to find which parameter came from where, I have to check request.getQueryString..
hey... I've entered the code between "pre" tags... but it won't show up... if you edit this question you can see the code...