You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Shoeman <st...@googlemail.com> on 2007/05/02 16:46:29 UTC

order of execution in the pipeline

Hello *,

I'm confused about the order in my pipeline:
I write a HTML-table, which gets transformed (with a custom action) in
a PDF.
The strange about it: Cocoon calls first the execution of my action and then
writes the HTML-file.


-----------------8<--------------------------------------------------------------------------
<map:transform type="write-source">
	  <map:parameter name="serializer" value="html"/>
</map:transform>
			
												
<map:act type="MyCustomAction"/>
			
					
<map:serialize type="html"/>
------------------------------------------------------>8--------------------------------------

Any idea, how I can write first the HTML an then call my action?

Thanks for reading...

---

Regards,

Stefan Shoeman

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


Re: deploying cocoon 2.1.10

Posted by Al Brown <mr...@lighttechnology.net>.
Al Brown wrote:
> Hi,
> I'm using fedora core 5. I'm using the apache webserver and tomcat5.
> I had cocoon 2.1.9 working.
> I add my code and that was working.
>
>
> Now I wanted to upgrade to 2.1.10
> I downloaded 2.1.10 and ran build war.
> I copied the cocoon.war into the webapps directory.
>
> Now I can not get it to deploy. It has removed the old cocoon file, 
> and it left all of my files, which seems nice of it.
>
> I have tried to use the tomcat manager but that has not worked either. 
> I have asked the manager to deploy the file. It will copy the 
> cocoon.war and it says that it worked but it will not run. I manually 
> stop and start. It say that both worked but cocoon is not deployed.
>
> Were do I look and what do I try next?
> Al
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> -- 
>
> This message has been verified by LastSpam eMail security service
>
> Ce courriel a été vérifié par le service de sécurité pour courriels 
> LastSpam
> http://www.lastspam.com
>
>
More info:
I found the tomcat log file. It has messages:

May 4, 2007 2:40:16 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive cocoon.war
May 4, 2007 2:40:16 PM org.apache.catalina.startup.ContextConfig 
applicationWebConfig
INFO: Missing application web.xml, using defaults only 
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cocoon]


I looked in the war file and there is a web.xml it at WEB-INF/web.xml

I'm using tomcat 5.5.15 and JVM 1.5

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


deploying cocoon 2.1.10

Posted by Al Brown <mr...@lighttechnology.net>.
Hi,
I'm using fedora core 5. I'm using the apache webserver and tomcat5.
I had cocoon 2.1.9 working.
I add my code and that was working.


Now I wanted to upgrade to 2.1.10
I downloaded 2.1.10 and ran build war.
 I copied the cocoon.war into the webapps directory.

Now I can not get it to deploy. It has removed the old cocoon file, and 
it left all of my files, which seems nice of it.

I have tried to use the tomcat manager but that has not worked either. I 
have asked the manager to deploy the file. It will copy the cocoon.war 
and it says that it worked but it will not run. I manually stop and 
start. It say that both worked but cocoon is not deployed.

Were do I look and what do I try next?
Al

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


Re: order of execution in the pipeline

Posted by Stefan Shoeman <st...@googlemail.com>.
Thanks a lot for your hints, Joerg. I will try it soon and post here,
how it works.

2007/5/4, Joerg Heinicke <jo...@gmx.de>:
> On 04.05.2007 17:58, Stefan Shoeman wrote:
> > Hello Marc,
> >
> > thanks for your hints. No, I can't use the standard pdf serializer,
> > because I have to create them with a external application.
> >
> > I tried to get my custom order with a flowscript. But that doesn't
> > work, too. I can't call another process (start the external app with
> > my action) _after_ the serialization of the html.
> >
> > It's frustrating...
>
> Come on Stefan ;)
>
> You can work with a setup very similar to the one I gave recently at [1]
> for a completely different use case. In contrary to this example your
> setup would be (again 3 pipelines):
>
> // same pattern as before
> <map:match pattern="">
>     // delegate to a flow script function
>     <map:call function="process"/>
> </map:match>
>
> // get file, transform it and write it to disk
> <map:match pattern="getFile">
>     <map:generate/>
>     // your transforms
>     <map:transform type="write-source"/>
>     <map:serialize type="xml"/>
> </map:match>
>
> // final processing
> <map:match pattern="showHtml">
>     <map:act type="MyCustomAction"/>
>     // it's probably possible to inject the document directly,
>     // otherwise get and transform the file again
>     <map:generate/>
>     // your transforms
>     <map:serialize/>
> </map:match>
>
> flow script:
>
> function process() {
>     var pipelineUtil = // get pipelineUtil
>     var data = // data you might need to retrieve the file
>     var document = pipelineUtil.processToDOM("getFile", data);
>     cocoon.sendPage("showHtml");
> }
>
> This is the easiest conversion possible I think. But having this setup
> you might improve and simplify it by dropping SourceWriteTransformer and
> changing the implementation of MyCustomAction a bit, so that it is no
> longer a Cocoon Action and no longer needs to reparse the file from disk.
>
> 1. drop <map:transform type="write-source"/> and <map:act
> type="MyCustomAction"/> completely
>
> 2. flow script:
> function process() {
>     var pipelineUtil = // get pipelineUtil
>     var data = // data you might need to retrieve the file
>     var document = pipelineUtil.processToDOM("getFile", data);
>     var myCustomAction = // get MyCustomAction, either POJO or simple
>                          // component independent from sitemap
>     myCustomAction.process(document);
>     cocoon.sendPage("showHtml");
> }
>
> You can also store the DOM on the disk to retrieve it from
> MyCustomAction. That's still better than to clutter the sitemap.
> Furthermore PipelineUtil provides methods to work with DOM, SAX or
> OutputStream, so you can integrate them even more, e.g. by providing a
> SAX ContentHandler.
>
> Hope that gets you the idea.
>
> Joerg
>
> [1] http://marc.info/?l=xml-cocoon-users&m=117784283420555&w=4
>
> ---------------------------------------------------------------------
> 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


Re: order of execution in the pipeline

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.05.2007 17:58, Stefan Shoeman wrote:
> Hello Marc,
> 
> thanks for your hints. No, I can't use the standard pdf serializer,
> because I have to create them with a external application.
> 
> I tried to get my custom order with a flowscript. But that doesn't
> work, too. I can't call another process (start the external app with
> my action) _after_ the serialization of the html.
> 
> It's frustrating...

Come on Stefan ;)

You can work with a setup very similar to the one I gave recently at [1] 
for a completely different use case. In contrary to this example your 
setup would be (again 3 pipelines):

// same pattern as before
<map:match pattern="">
    // delegate to a flow script function
    <map:call function="process"/>
</map:match>

// get file, transform it and write it to disk
<map:match pattern="getFile">
    <map:generate/>
    // your transforms
    <map:transform type="write-source"/>
    <map:serialize type="xml"/>
</map:match>

// final processing
<map:match pattern="showHtml">
    <map:act type="MyCustomAction"/>
    // it's probably possible to inject the document directly,
    // otherwise get and transform the file again
    <map:generate/>
    // your transforms
    <map:serialize/>
</map:match>

flow script:

function process() {
    var pipelineUtil = // get pipelineUtil
    var data = // data you might need to retrieve the file
    var document = pipelineUtil.processToDOM("getFile", data);
    cocoon.sendPage("showHtml");
}

This is the easiest conversion possible I think. But having this setup 
you might improve and simplify it by dropping SourceWriteTransformer and 
changing the implementation of MyCustomAction a bit, so that it is no 
longer a Cocoon Action and no longer needs to reparse the file from disk.

1. drop <map:transform type="write-source"/> and <map:act 
type="MyCustomAction"/> completely

2. flow script:
function process() {
    var pipelineUtil = // get pipelineUtil
    var data = // data you might need to retrieve the file
    var document = pipelineUtil.processToDOM("getFile", data);
    var myCustomAction = // get MyCustomAction, either POJO or simple
                         // component independent from sitemap
    myCustomAction.process(document);
    cocoon.sendPage("showHtml");
}

You can also store the DOM on the disk to retrieve it from 
MyCustomAction. That's still better than to clutter the sitemap. 
Furthermore PipelineUtil provides methods to work with DOM, SAX or 
OutputStream, so you can integrate them even more, e.g. by providing a 
SAX ContentHandler.

Hope that gets you the idea.

Joerg

[1] http://marc.info/?l=xml-cocoon-users&m=117784283420555&w=4

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


Re: order of execution in the pipeline

Posted by Stefan Shoeman <st...@googlemail.com>.
Hello Marc,

thanks for your hints. No, I can't use the standard pdf serializer,
because I have to create them with a external application.

I tried to get my custom order with a flowscript. But that doesn't
work, too. I can't call another process (start the external app with
my action) _after_ the serialization of the html.

It's frustrating...

Regards,

Stefan

2007/5/3, Marc Portier <mp...@outerthought.org>:
>
>
> Stefan Shoeman wrote:
> > Hello *,
> >
> > I'm confused about the order in my pipeline:
> > I write a HTML-table, which gets transformed (with a custom action) in
> > a PDF.
> > The strange about it: Cocoon calls first the execution of my action and
> > then
> > writes the HTML-file.
> >
> >
> > -----------------8<--------------------------------------------------------------------------
> >
> > <map:transform type="write-source">
> >       <map:parameter name="serializer" value="html"/>
> > </map:transform>
> >
> >
> > <map:act type="MyCustomAction"/>
> >
> >
> > <map:serialize type="html"/>
> > ------------------------------------------------------>8--------------------------------------
> >
> >
> > Any idea, how I can write first the HTML an then call my action?
> >
>
> You can't.
>
> sitemap 101:
>
> Matchers and actions and the like are 'interpreted/executed' first to
> actually decide on the fixed, definitive and configured chain of
> generator, transformers, serializer (called the pipeline) that should
> handle this http-request.
>
> Then that configured pipeline is 'executed', meaning the generator
> starts producing sax-events that should flow through the (then
> unchangeable) set of transformers (some of those events might get
> blocked or translated by those) to eventually be translated into the
> http-response byte-stream by the serializer
>
> summary:
> - none pipeline components in the sitemap
>   - work on the request
>   - select, configure and assemble the pipeline components (GT*S) to use
> - those pipeline components then
>   - work to produce the response
>   - based on sax-events flowing through
>
>
> Back to your case now: what do you really want to do?
>
> Why don't you just transform the html to xsl-fo and then serialize that
> to pdf?
>
> Have you checked the hello-world samples? They show how to do the above.
>
>
> HTH,
> -marc=
>
>
> ---------------------------------------------------------------------
> 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


Re: order of execution in the pipeline

Posted by Marc Portier <mp...@outerthought.org>.

Stefan Shoeman wrote:
> Hello *,
> 
> I'm confused about the order in my pipeline:
> I write a HTML-table, which gets transformed (with a custom action) in
> a PDF.
> The strange about it: Cocoon calls first the execution of my action and
> then
> writes the HTML-file.
> 
> 
> -----------------8<--------------------------------------------------------------------------
> 
> <map:transform type="write-source">
>       <map:parameter name="serializer" value="html"/>
> </map:transform>
>            
>                                                
> <map:act type="MyCustomAction"/>
>            
>                    
> <map:serialize type="html"/>
> ------------------------------------------------------>8--------------------------------------
> 
> 
> Any idea, how I can write first the HTML an then call my action?
> 

You can't.

sitemap 101:

Matchers and actions and the like are 'interpreted/executed' first to
actually decide on the fixed, definitive and configured chain of
generator, transformers, serializer (called the pipeline) that should
handle this http-request.

Then that configured pipeline is 'executed', meaning the generator
starts producing sax-events that should flow through the (then
unchangeable) set of transformers (some of those events might get
blocked or translated by those) to eventually be translated into the
http-response byte-stream by the serializer

summary:
- none pipeline components in the sitemap
  - work on the request
  - select, configure and assemble the pipeline components (GT*S) to use
- those pipeline components then
  - work to produce the response
  - based on sax-events flowing through


Back to your case now: what do you really want to do?

Why don't you just transform the html to xsl-fo and then serialize that
to pdf?

Have you checked the hello-world samples? They show how to do the above.


HTH,
-marc=


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