You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by PlanetCocoon Users Forum <co...@planetcocoon.com> on 2005/05/20 13:24:44 UTC

[Forum] Problems using the module:request:inputStream source in flowscript

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