Timothy Gallagher wrote:
> .The HTTP specification mentions that you can POST to a CGI using a URL
> with QUERY information attached to the end. This is a valid way to
> request a service, and means that in traditional CGI processing you
> would have to parse the QUERY string as well as the message CONTENT.
>
> A Servlet engine may take this approach of still separating the
> information.
>
> (BTW - I'm using Apache JServ, and it see both during a POST)
>
More specifically for Apache JServ 1.0, the ServletRequest.getParameter()
family of calls work like this: if the request is a GET, it parses the query
string; if the request is a POST, it parses the posted content data instead.
In neither case does it ever combine the two sources. It is not obvious from
the 2.0 servlet API spec, but it seems to me that this is the correct
behavior. (That's the nice thing about open source -- you don't have to guess
what is really happening. :-)
On occasion, I have needed to combine parameters from the input form (sent via
a POST request) and the query parameters of the request URI. To do this, I
have ignored the getParameter() call. Instead, I use both
HttpUtils.parseQueryString() and HttpUtils.parsePostData(), and then combine
the two resulting hashtables. That way, I can make my own rules about which
source overrides the other, without depending on a servlet engine's possibly
differing interpretation.
This kind of thing is pretty easy to package up into reusable tool (in my case
it's a static method called getParameters() in a utility class, and takes the
HttpServletRequest as its input), so you only have to write the nitty gritty
details once. And it will be 100% portable to servlet engines that conform to
the API.
>
> Tim Gallagher
>
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html