cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: Runnable in flowscript?
Date Fri, 19 Mar 2010 18:12:43 GMT
function create_pdf() {
     var use_background_thread=true;
     var path=cocoon.parameters["report"];
     var fmt=cocoon.parameters["format"];
     var queryInfo=getRequestParameters();
     var url=path+"?"+queryInfo;
     var output_file=java.io.File.createTempFile(path,".pdf");
     var output_stream=new com.spectron.io.FileProgressOutputStream(output_file);

     if(use_background_thread){
         var r = new java.lang.Runnable() {
             run: function() {
                 // gives an exception here on the console
                 cocoon.processPipelineTo(fmt+"_pipe/"+url,'',output_stream);  //COMMENT:
CAN I SEE relevant sitemap snippets and corresponding generator for this pipeline?? And still
replace the '' by {} just to be sure
                 output_stream.close();
             }
         };
         new java.lang.Thread(r).start();
         // this works, just never finishes because of exception in thread
         while(!output_stream.isClosed()) {
             cocoon.sendPageAndWait(
                 "progress.jx",
                  { 
                      "length" : output_file.length(), 
                      "output_path" : output_file.getCanonicalPath(), //COMMENT: REMOVE the
COMMA
                  }
             );
         }
     } else{
         cocoon.processPipelineTo(fmt+"_pipe/"+url,'',output_stream);  //COMMENT: And still
replace the '' by {} just to be sure
         output_stream.close();
     }
     cocoon.sendPage( 
           fmt+"_pipe/"+url, 
           {
               file_name : output_file.getCanonicalPath() 
           } 
      );
}

-----Original Message-----
From: Fawzib Rojas [mailto:f_rojas@spectron-msim.com] 
Sent: Friday, March 19, 2010 7:00 PM
To: users@cocoon.apache.org
Subject: Re: Runnable in flowscript?

On 3/19/2010 1:56 PM, Robby Pelssers wrote:
> Function processPipelineTo([String] uri, [Object] bizData, [java.io.OutputStream] stream)
>
> The api says is should be an object...
>
> So maybe try
>
> cocoon.processPipelineTo(fmt+"_pipe/"+url, {} ,output_stream); //using object literal
>
>    

Thats not it, because when I set use_background_thread to false to do it 
directly without a thread (the else) it works.

> I don't know if you need a context but you sure aren't setting any...
>
>    

I'm not setting a context in the thread, I guess I need to use the 
context from the create_pdf function. How would I do that? Is there some 
documentation for that somewhere?

> Cheers,
> Robby
>
>    


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


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


Mime
View raw message