tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Trasuk" <stratus...@on.aibn.com>
Subject RE: Bug in Tomcat ? - forwarding HTTP request from a Servlet to a JSP
Date Wed, 18 Jul 2001 05:07:30 GMT
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)
----------------------------------------------------------------------------
----------------------------------------------

 <<LogonServlet.java>>  <<PronServlet.java>>


Mime
View raw message