You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bala Sambandam <ba...@yahoo.com> on 2001/03/30 19:22:59 UTC

Re: getInputStream from within XSP page (FIXED)

I found the issue.  From the following stack dump of 
org.apache.tomcat.core.RequestImpl.getInputStream() just before my stack 
dump:

java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:979)
        at org.apache.tomcat.core.RequestImpl.getInputStream(RequestImpl.java:776)
        at org.apache.tomcat.facade.HttpServletRequestFacade.getInputStream(HttpServletRequestFacade.java:201)
        at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:100)
        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(HttpServletRequestFacade.java:222)
        at org.apache.cocoon.Engine.getFlag(Engine.java:511)
        at org.apache.cocoon.Engine.handle(Engine.java:265)
        at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
        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:797)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.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:475)



it seems that org.apache.cocoon.Engine.getFlag makes a call to 
request.getParameter which makes any further calls to getInputStream 
from within any XSP pages unreliable.  My workaround for now is to use 
request.getParameter and hope that I don't need to read unencoded post 
data in the future.  If I do, then I'll probably figure out how to hack 
Engine.getFlag to preserve the InputStream.

later,
Bala



Bala Sambandam wrote:

> Hello,
> 
> I can't seem to get POST'ed data from within my XSP page.  GET data 
> seems to work fine.  My page declaration looks like the following:
> 
> <xsp:page
>  xmlns:xsp="http://www.apache.org/1999/XSP/Core" 
> <http://www.apache.org/1999/XSP/Core>
>  xmlns:esql="http://apache.org/cocoon/SQL/v2" 
> <http://apache.org/cocoon/SQL/v2>
>  xmlns:dbutils="http://www.idanim.com/2001/XSP/DBUtils" 
> <http://www.idanim.com/2001/XSP/DBUtils>
>  xmlns:mail="http://apache.org/cocoon/mail/v1" 
> <http://apache.org/cocoon/mail/v1>
>  xmlns:request="http://www.apache.org/1999/XSP/Request" 
> <http://www.apache.org/1999/XSP/Request>
>  >
> 
> dbutils is just some ESQL add on stuff.
> 
>  From within some <xsp:logic> block, if I do things like:
> 
> request.getParameter("some.param");
> <request:get-paramater name="some.param"/>
> // returns nothing when method is post
> 
> Hastable data = HttpUtils.parsePostData(
>   request.getContentLength(),
>   request.getInputStream()
> );
> // throws short read exception
> 
> 
> System.err.println("content length: " + request.getContentLength());
> System.err.println("available: " + request.getInputStream().available());
> // content length is > 1, available is = 0.
> 
> they all seem to respond as if the InputStream is already empty, but I 
> can't seem to figure out what's reading the data from the 
> InputStream.  Does anybody know what's going on here?  Am I missing 
> something?
> 
> I'm running Apache 1.3.12, mod_ssl, mod_jk, Jakarta 3.2.1 and Cocoon 
> 1.8.2 on Linux 6.2.  I've also tried to run Jakarta and Cocoon 
> standalone, but I get the same behavior.
> 
> thanks,
> Bala
> 
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 
>