cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piratenvisier <hansheinrichbr...@yahoo.de>
Subject Re: Jexl in embedded Pipeline
Date Thu, 13 Mar 2014 14:02:31 GMT
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 <hansheinrichbraun@yahoo.de 
> <mailto:hansheinrichbraun@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 <hansheinrichbraun@yahoo.de
>>     <mailto:hansheinrichbraun@yahoo.de>>:
>>
>>         How can I use Jexl in an embadded Pipline ?
>>
>>         ---------------------------------------------------------------------
>>         To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>         <mailto:users-unsubscribe@cocoon.apache.org>
>>         For additional commands, e-mail: users-help@cocoon.apache.org
>>         <mailto:users-help@cocoon.apache.org>
>>
>>
>
>


Mime
View raw message