Try using this class for testing, after replacing the URL as shown below. It will show that thw servlet is still working, just that it needs a Stream to read from.
import java.io.*; import java.net.*; public class ServletInputStreamTesterMain { public static void main(String args[])throws Exception { URL url = new URL("http://localhost:8080/xy/servlet/ServletInputStreamTester");// <--Replace the actual URL of the servlet here URLConnection con = url.openConnection(); con.setDoInput(true); con.setDoOutput(true); OutputStream out = con.getOutputStream(); // <--writing to the servlet, so that it has a Stream to read for(int i=0;i<100;i++) { out.write(i); } out.flush(); out.close(); InputStream in = con.getInputStream(); int j=0; while((j=in.read())!=-1) // <--Reading the output back from the servlet. { System.out.println(j); } in.close(); } } Hope this helps. Regards Sanjeev -----Original Message----- From: Adrian Wilford [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 5:43 PM To: [EMAIL PROTECTED] Subject: HttpServletRequest Inputstream already been read 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 ___________________________________________________________________________ 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