You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ivan Venuti <i....@caribel.pisa.it> on 2002/12/17 13:31:01 UTC

bug in Tomcat 4 or .... what?

Hi,

I have a servlet that opens a DataInputStrem on the request (see below)

public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException    {

 try{
   // Open the I/O streams
    DataInputStream in = new DataInputStream(request.getInputStream() );

After this pice of code I cant' access any more to the request parameters.
Infact this code:

request.getParameter("anyParameter")

retrieves ALWAYS null.
The strange thing is that this servlet was Ok for tomcat 3, but can't work
any more with Tomcat4.

Anyone can explain why opening a DataInputStream alters the
HttpServletRequest?

Thanks

-- Ivan Venuti --



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: bug in Tomcat 4 or .... what?

Posted by Mike W-M <mi...@ward-murphy.co.uk>.
>From the Servlet Spec (2.3)'s section on the getParameter() method:
<<
If the parameter data was sent in the request body, such as occurs with an
HTTP POST request, then reading the body directly via getInputStream() or
getReader() can interefere with the execution of this method.
>>
I believe there's other stuff in there too about not expecting everything to
work as normal if you go low-level messing around with the request.

Mike.

----- Original Message -----
From: "Ivan Venuti" <i....@caribel.pisa.it>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 12:31 PM
Subject: bug in Tomcat 4 or .... what?


Hi,

I have a servlet that opens a DataInputStrem on the request (see below)

public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException    {

 try{
   // Open the I/O streams
    DataInputStream in = new DataInputStream(request.getInputStream() );

After this pice of code I cant' access any more to the request parameters.
Infact this code:

request.getParameter("anyParameter")

retrieves ALWAYS null.
The strange thing is that this servlet was Ok for tomcat 3, but can't work
any more with Tomcat4.

Anyone can explain why opening a DataInputStream alters the
HttpServletRequest?

Thanks

-- Ivan Venuti --



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>