Hi All,
Is there a difference in the servlet specification in the latest versions,
 to do with when the request input stream is read, 
because i have an old servlet that works with ServletExec 3.0, 
but does not work with Tomcat 4.0.4 the section of code that it 
fails on is equivalent to the following (fails at ****):

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class ServletInputStreamTester extends HttpServlet
{
        public ServletInputStreamTester()
        {
                super();
        }
        
        public void service(HttpServletRequest rq, HttpServletResponse rs)
                                                                                       
 throws javax.servlet.ServletException, 
                                                                                       
 java.io.IOException
        {
                int li_Byt = -1;
                InputStream in = rq.getInputStream();
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                while((li_Byt = in.read()) != -1)   //****blocks here and then fails 
due to a java.net.SocketTimeoutException: Read timed out
                {
                        bos.write(li_Byt);
                }
                System.out.println(bos.toString());
                rs.getOutputStream().write(bos.toByteArray());
        }
}


i suspect that the inputstream has already been read?

does anyone know why this happens?

Thanks
Adrian Wilford

___________________________________________________________________________
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

Reply via email to