Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 63664 invoked by uid 500); 18 Jul 2001 05:06:24 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 63649 invoked from network); 18 Jul 2001 05:06:24 -0000 Received: from tomts5.bellnexxia.net (HELO tomts5-srv.bellnexxia.net) (209.226.175.25) by h31.sny.collab.net with SMTP; 18 Jul 2001 05:06:24 -0000 Received: from TRASUKGNOTE ([64.229.0.144]) by tomts5-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP id <20010718050602.CXBI16844.tomts5-srv.bellnexxia.net@TRASUKGNOTE> for ; Wed, 18 Jul 2001 01:06:02 -0400 From: "Greg Trasuk" To: Subject: RE: Bug in Tomcat ? - forwarding HTTP request from a Servlet to a JSP Date: Wed, 18 Jul 2001 01:07:30 -0400 Message-ID: <002801c10f47$8c515680$4b05020a@TRASUKGNOTE> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hello: From what I can tell: (1) In your PronServlet.java service() method, you are manually parsing the form data using the stream returned by request.getInputStream() (2) In the JSP page, Tomcat is attempting to parse the form data again. The servlet API docs specify that you can only call getInputStream() once on a request, and that doing so may cause problems reading parameters, so I suspect that's the source of your problem. I'm not entirely sure why the generated JSP servlet is trying to read the parameters. Perhaps you're using the parameters in the JSP page, or perhaps the JSP engine just reads it by default, which would seem reasonable to me. The simple workaround would be not to parse the form data in your PronServlet, but to just use request.getParameter() and let Tomcat handle it. That's the way I've done it in the past, and haven't had problems. Greg Trasuk, President StratusCom Manufacturing Systems Inc. - We use information technology to solve business problems on your plant floor. http://stratuscom.ca -----Original Message----- From: Sampige, Srinivas [mailto:Srinivas.Sampige@PSS.Boeing.com] Sent: Tuesday, July 17, 2001 5:59 PM To: tomcat-user@jakarta.apache.org Subject: Bug in Tomcat ? - forwarding HTTP request from a Servlet to a JSP Hi Iam using tomcat 3.2.1 and i have a servlet "PronServlet" that extends from HttpServlet . Now i have a servlet "LogonServlet" that extends from servlet "PronServlet" (which has got common functionality like checking for a valid session ;has common methods that perform functionality like forwarding HTTP request to another url). In "LogonServlet" i have some code that does some processing and finally forwards the HTTP request to a JSP .Iam getting an error which iam pasting below.I ran the same application on JRun and it works fine .I noticed that if i removed the subclassing and instead subclassed LogonServlet directly from HttpServlet then the application works fine by forwarding the request to the next JSP .Here is the console output .Iam attaching the source code of PronServlet and LogonServlet .Anybody from the Tomcat dev team any ideas..... ? ---------------------------------------------------------------------------- ------------------------------ Creating a session for the user... Forwarding request to the MENU page... 2001-07-17 02:17:22 - Ctx( /pron ): Exception in: R( /pron + /webUi/pronMenu.jsp + null) - java.lang. IllegalArgumentException: Short Read at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:238) at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101) at org.apache.tomcat.core.RequestImpl.handleParameters(RequestImpl.java:691) at org.apache.tomcat.core.RequestImpl.getParameterValues(RequestImpl.java:259) at org.apache.tomcat.core.RequestImpl.getParameter(RequestImpl.java:250) at org.apache.tomcat.facade.HttpServletRequestFacade.getParameter(HttpServletRe questFacade.ja va:222) at org.apache.jasper.servlet.JspServlet.preCompile(JspServlet.java:326) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:370) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl .java:194) at com.boeing.pron.servlets.LogonServlet.handleApplicationEvent(LogonServlet.ja va:61) at com.boeing.pron.servlets.PronServlet.service(PronServlet.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandl er.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) ---------------------------------------------------------------------------- ---------------------------------------------- <> <>