Hello Greg,

I got  what I was looking for by using a programmed Pipeline.
Starting with Velocity to fill up an xmlstring with Hibernate bean data.
The only problem is that sometimes when I call Hibernate I get an error because there is no Hibernate session.
Maybe the reason is how I placed the lazy loading filte in the web.xm.

When I have time I investgate several other opportunities.

JAXBGenerator here I am missing some fields. I still don't know what is the reason. Maybe because I mix up different annotations.(Hibernate, JAXB)

What is also working is simple calling the cocoon pipline snippets by localhost:8888

I am also trying to get the result of the URLResponse in the application. But till now I was not successful.

I also succeeded to replace Velocity by using the StringGenerator.

The last aspect I am investigating is using more cloud technology by sending only links. But here I have to think about that the Information should not publicly accessible.

Greetings
Heiner


Am 14.03.2014 08:25, schrieb gelo1234:
Cocoon 3 pipelines are either SAX or StAX events based so they operate upon xml data. If you could feed XML into another pipeline component that's fine. Just ask yourself if you really need Cocoon for the task you are trying to complete.

Greetings,
Greg


2014-03-14 6:13 GMT+01:00 Yahoo <hansheinrichbr...@yahoo.de <mailto:hansheinrichbr...@yahoo.de>>:

    I found what I want todo. It's not  Jexl it's the VelocityEngine I
    need.
    Here is the example from spring mail.

        MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                 message.setTo(user.getEmailAddress());
                 message.setFrom("webmas...@csonth.gov.uk"  
<mailto:webmas...@csonth.gov.uk>);/// could be parameterized.../
                 Map model = new HashMap();
                 model.put("user", user);
                 String text = VelocityEngineUtils.mergeTemplateIntoString(
                    velocityEngine, "com/dns/registration-confirmation.vm", 
model);
                 message.setText(text, true);


    In my case the text comes from an inline Cocoon Pipeline.
    I could first import the template use the Velocity Engine and then
    give it to the Pipeline.
    or is there possibility to make the job done by the pipeline .

    Am 13.03.2014 19:34, schrieb gelo1234:
    I don't know about the attachments but a clean Cocoon3 extension
    for sending emails you can find here:

    
https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java

    Greetings,
    Greg


    2014-03-13 15:02 GMT+01:00 Piratenvisier
    <hansheinrichbr...@yahoo.de <mailto:hansheinrichbr...@yahoo.de>>:

        An application like this I use already.
        Thorsten Scherler made this email Application for me.
        The important point: I want to send an email and the Email
        Text and the attachements are produced by cocoon pipelines.
        This a an important part of my cocoon 2.10 application which
        I wanted to transfer to 3.0

        Am 13.03.2014 14:23, schrieb gelo1234:
        I got lost with your explanation :) It's a kind of awkward
        thing to me that you are actually trying to do with that code.


        Why not making it clean:

        1. First you need a String-Template match to serialize the
        Hibernate bean -> output XML with final values

        <map:match  pattern="hibernate/bean">
                 <map:generate  src="bean.xml"  type="stringtemplate"  />
                 <map:serialize  type="xml"  />
        </map:match>
        where bean.xml is your [input]

        You can now feed angebot bean data into hibernate/bean pipe
        above (to get it serialized):
        <map:match  pattern="hibernate/{id}">
                 <controller:call  controller="rest-controller"  
select="BeanController">
                   <map:parameter  name="id"  value="{map:id}"  />
                 </controller:call>
        </map:match>


        @RESTController
        public  class  BeanController  implements  Get  {

             @SitemapParameter
             private  String  id;

             @RequestParameter
             private  String  name;
// through injection or other way

             HibernateDAO dao;

              public  RestResponse  doGet()  throws  Exception  {
                 Map<String,  Object>  data=  new  HashMap<String,  Object>();
                 data.put("angebot",  dao.getAngebotBean(id));
                 data.put("name",  this.name);

                 return  new  Page("servlet:/hibernate/bean",  data);
             }
        }
        At this point you got your Hibernate bean serialized (into
        XML data).

        2. Second you can go for XSLT Transformer and transform XML
        into anything you want

        You don't need any JEXL here.


        Greetings,
        Greg




        2014-03-13 13:30 GMT+01:00 Yahoo <hansheinrichbr...@yahoo.de
        <mailto:hansheinrichbr...@yahoo.de>>:

            I used the EmailPlainPipe from the distribution:
              byte[] bytes = (byte[]) parameters.get("input");
                    XMLGenerator generator = new XMLGenerator(bytes);
            this.addComponent(generator);
                    byte[] xsl = (byte[]) parameters.get("xsl");
                    Source xslSource = new StreamSource(new
            ByteArrayInputStream(xsl));
                    XSLTTransformer transformer = new XSLTTransformer(
                            xslSource, new Date().getTime());
                    // pass all parameter to the xslTransformer
            transformer.setParameters(parameters);
            this.addComponent(transformer);
            this.addComponent(TextSerializer.createPlainSerializer());
            super.setup(outputStream, parameters);
            where input is:
            <?xml version="1.0" encoding="UTF-8"?>
            <angebot>
              <id>$name$$angebot.id <http://angebot.id>$</id>
             <anganz>$angebot.anganz$</anganz>
            
<angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
            </angebot>
            xsl is the identity
            angebot is a Hibernate Bean.
how do feed the pipeline with this Bean that it is used by Jexl to resolve the input String.


            Am 13.03.2014 12:55, schrieb gelo1234:
            With servlet-sitemaps Jexl can be used within any
            pipeline as {jexl:.....} value.

            Please show example of your embedded pipeline ?

            Greetings,
            Greg


            2014-03-13 11:09 GMT+01:00 Yahoo
            <hansheinrichbr...@yahoo.de
            <mailto:hansheinrichbr...@yahoo.de>>:

                How can I use Jexl in an embadded Pipline ?

                
---------------------------------------------------------------------
                To unsubscribe, e-mail:
                users-unsubscr...@cocoon.apache.org
                <mailto:users-unsubscr...@cocoon.apache.org>
                For additional commands, e-mail:
                users-h...@cocoon.apache.org
                <mailto:users-h...@cocoon.apache.org>









Reply via email to