cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PlanetCocoon Users Forum <cocoon-us...@planetcocoon.com>
Subject [Forum] Problems using the module:request:inputStream source in flowscript
Date Fri, 20 May 2005 11:24:44 GMT
Hello everybody,

I'm trying to use the "module:request:inputStream" source as described 
in http://wiki.apache.org/cocoon/ModuleSource to get the the full 
content of a request (an XML).


I'm using the stream example that came with cocoon 
(cocoon/samples/stream/process-order), and I have edited the sitemap to 
call a flowscript function:

    <map:match pattern="process-order">
      <map:generate type="stream">
        <map:parameter name="defaultContentType" value="text/xml"/>
        <map:parameter name="form-name" value="Foo"/>
      </map:generate>
      <map:call function="getRequestBodyDocument">
      </map:call>
...

However, it doesn't work as planned. The 
cocoon.request.getContentLength() returns a non-zero value (2526), but  
the inputStream source's getContentLength() returns -1, and the stream 
returns an empty string. Flowscript code:

     cocoon.log.info("Content length: 
"+cocoon.request.getContentLength()); // Logs 2526
     var resolver = null;
     var source = null;
     try {
         resolver = cocoon.getComponent( SourceResolver.ROLE );
         source = resolver.resolveURI("module:request:inputStream");
         var is = source.getInputStream();
         cocoon.log.info("Content length: "+source.getContentLength()); 
// Logs -1, is.available() returns 0
         ...

Does anyone have a clue why the inputStream source is empty?

Thanks in advance for your help,

Rune


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message