tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kenneth.baltz" <kenneth.ba...@inforonics.com>
Subject RE: getParameter vs getInputStream
Date Tue, 25 Apr 2000 14:44:14 GMT
A JSP _is_ a servlet, or at least .jsp files are compiled into servlets at
runtime.  So if you can't use this method in a servlet (I'll take your word
for it), then you can't use it in a JSP.  Looking at the documentation, I
think this method should work in both servlets and JSPs, but you should not
mix it with getParameter().
 
K.C.

-----Original Message-----
From: Matthew Jones [mailto:matthew@pacificsw.com]
Sent: Tuesday, April 25, 2000 10:27 AM
To: tomcat-user@jakarta.apache.org
Subject: getParameter vs getInputStream


I posted earlier about not being able to get getInputStream to work in a JSP
and now I am more convinced that there is a problem.
 
Here's what happens:  If I read getInputStream or getReader they always
return with EOF.  I sent binary data up and the compiled JSP threw an
exception in trying to parse the parameters!
 
In the ServletRequest  getParameter Javadoc it says the following..


If the parameter data was sent in the request body, such as occurs with an
HTTP POST request, then reading the body directly via
<file:///D:/j2sdkee1.2/doc/api/javax/servlet/ServletRequest.html#getInputStr
eam()> getInputStream() or
<file:///D:/j2sdkee1.2/doc/api/javax/servlet/ServletRequest.html#getReader()
> getReader() can interfere with the execution of this method.

So what I think is happening is that the JSP is parsing the input as if it
were CGI therefore the input has been consumed.  By the time I try to read
the InputStream all the data has already been read, by the parameter parser.

I have not tried this using a Servlet yet, just a JSP, but that is the next
step.
I am looking at the JSP spec and I can't find any place where it says I
can't use the raw input stream.
Is my analysis correct?  Is this a feature or a bug?
 
Matthew Jones
matthew@pacificsw.com <mailto:matthew@pacificsw.com> 


Mime
View raw message