I'd like a clarification on the 2.1a Servlet Spec.
The question is an interaction between
ServletRequest.getParameter() and
RequestDispatcher.forward(). I've looked in the march
archives and didn't find anything directly relative and I
found the search page of the archives to be non-responsive.
I'm assuming that getParameter() looks in the body of the
request on a POST in order to find the values. To do this
it implicitly calls ServletRequest.getInputStream() or
getReader(). Both of those methods say that they must throw
IllegalStateException if the other method was previously
called. They do not describe the behavior if the same
method is called subsequently.
I assume that one of the reasons for the described behavior
is so that the engine does not have to buffer the body of
the request. That is the behavior I would wish for.
Now, say I have one servlet that based on the value of a
parameter decides to forward the request to another servlet.
Is the second servlet allowed to call getInputStream() or
getReader()? I assume that these methods are allowed to
throw IllegalStateException if the (other) method was
previously called. But in this case they were only called
implicitly via getParamter().
Logically I then presume that if the first servlet calls
getParameter() on a POST and then forwards the request to
another servlet, that a call to getParameter() on the 2nd
servlet will/may also throw IllegalStateException. Is this
the case?
I believe that spec for getInputStream() and getReader()
should be modified to say that they will throw
IllegalStateException if they were previously called or if
getParameter() was previously called for a POST. Also that
the text for forward() and include() should be modified to
say the request sent the subsequent servlet might have had
its body previously consummed and may not be available to
the subsequent servlet.
Howard
___________________________________________________________________________
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