Return-Path: X-Original-To: apmail-cocoon-users-archive@www.apache.org Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 71A0C10C87 for ; Thu, 13 Mar 2014 18:35:21 +0000 (UTC) Received: (qmail 18474 invoked by uid 500); 13 Mar 2014 18:35:20 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 18001 invoked by uid 500); 13 Mar 2014 18:35:17 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 17984 invoked by uid 99); 13 Mar 2014 18:35:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 18:35:15 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gelo1234@gmail.com designates 209.85.214.178 as permitted sender) Received: from [209.85.214.178] (HELO mail-ob0-f178.google.com) (209.85.214.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 18:35:11 +0000 Received: by mail-ob0-f178.google.com with SMTP id wp18so1448813obc.37 for ; Thu, 13 Mar 2014 11:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Vr8H808B18Wzy2E5iOi8+hoUc3pm8Ob5cC67Hbt5Opk=; b=VAC7ihX7AyNGgqCRqUBfL42tf969wDM489Y9717/sAdV5D0cpQH0ZLRa8MB5oF4wiz HWbaNmUimjN2zPGFzUx09+Y282jo4gnNknAX16qf5w/ueeJFvY6CGqITNGc//HWlaEWl eWSTjcGhj62KRB45KRttB1JqC8rdRzHBpSl+/GoIR1vnDPzKm/H3gNctokdozDoMV35d 180PgUsnievHaMDspBX9rt7DBLJp5K9KcDAjE2g5D2AN6ScZe7uAWKA9sY0slbIy8vG/ 28uh6ObJIMwBkw8sQDwO8FBPRsIYZIDr2ieb3ei8VaqdSJ+lhJ1LbDmECwRrn7SdSBPW j9IQ== MIME-Version: 1.0 X-Received: by 10.60.94.231 with SMTP id df7mr2037027oeb.69.1394735691129; Thu, 13 Mar 2014 11:34:51 -0700 (PDT) Received: by 10.76.102.100 with HTTP; Thu, 13 Mar 2014 11:34:51 -0700 (PDT) In-Reply-To: <5321BA77.10100@yahoo.de> References: <5313F8D2.4080000@yahoo.de> <53142A94.30407@apache.org> <531645D5.9050506@yahoo.de> <53198E35.4090002@yahoo.de> <531AB7FE.10400@yahoo.de> <532183D3.1060707@yahoo.de> <5321A4FE.9020108@yahoo.de> <5321BA77.10100@yahoo.de> Date: Thu, 13 Mar 2014 19:34:51 +0100 Message-ID: Subject: Re: Jexl in embedded Pipeline From: gelo1234 To: Cocoon Users Content-Type: multipart/alternative; boundary=089e011761836ce94a04f4813501 X-Virus-Checked: Checked by ClamAV on apache.org --089e011761836ce94a04f4813501 Content-Type: text/plain; charset=ISO-8859-1 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 : > 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 > > > > > > where bean.xml is your [input] > > You can now feed angebot bean data into hibernate/bean pipe above (to > get it serialized): > > > > > > > @RESTControllerpublic 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 data = new HashMap(); > 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 : > >> 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: >> >> >> $name$$angebot.id$ >> $angebot.anganz$ >> $angebot.angkurzbeschreibung$ >> >> 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 : >> >>> How can I use Jexl in an embadded Pipline ? >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org >>> For additional commands, e-mail: users-help@cocoon.apache.org >>> >>> >> >> > > --089e011761836ce94a04f4813501 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I d= on't know about the attachments but a clean Cocoon3 extension for sendi= ng emails you can find here:

https://github.com/alveolo/butterfly/blob/m= aster/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSeri= alizerTest.java

Greetings,=
Greg


2014-03-13 15:02 GMT+01:00 Piratenvisier <<= a href=3D"mailto:hansheinrichbraun@yahoo.de" target=3D"_blank">hansheinrich= braun@yahoo.de>:
=20 =20 =20
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 p=
attern=3D"hibernate/bean"&=
gt;
        <map:generate src<=
span>=3D"bean.xml" type=3D"stringtemplate" />
        <map:serialize type=3D"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 p=
attern=3D"hibernate/{id}"&=
gt;
        <controller:call controll=
er=3D"rest-controller" select=3D"BeanController">
          <map:parameter name=3D"id" value=3D"{map:id}" /&g=
t;
        </controller:call>
</map:match>


@RESTController
public class BeanController implements =
Get {

    @SitemapParameter
    private String id;

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

   =A0HibernateDAO dao;

   =A0public RestRespon=
se doGet() throws Exception {
        Map<String,<=
/span> Object> data =
=3D new HashMap<String, =
Object>();
        data.put("=
angebot", dao.get<=
/span>AngebotBean(id));
        data.put("=
name", this.name);

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

2. Second yo= u 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@yah= oo.de>:
I used the EmailPlainPipe from the distribution:
=A0 byte[] bytes =3D (byte[]) parameters.get("input"= ;);
=A0=A0=A0=A0=A0=A0=A0 XMLGenerator generator =3D new XMLGener= ator(bytes);
=A0=A0=A0=A0=A0=A0=A0 this.addComponent(generator);
=A0=A0=A0=A0=A0=A0=A0 byte[] xsl =3D (byte[]) parameters.get(= "xsl");
=A0=A0=A0=A0=A0=A0=A0 Source xslSource =3D new StreamSource(n= ew ByteArrayInputStream(xsl));
=A0=A0=A0=A0=A0=A0=A0 XSLTTransformer transformer =3D new XSL= TTransformer(
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 xslSource, new = Date().getTime());
=A0=A0=A0=A0=A0=A0=A0 // pass all parameter to the xslTransfo= rmer
=A0=A0=A0=A0=A0=A0=A0 transformer.setParameters(parameters);<= br> =A0=A0=A0=A0=A0=A0=A0 this.addComponent(transformer);
=A0=A0=A0=A0=A0=A0=A0 this.addComponent(TextSerializer.createPlainSerializer()); =A0=A0=A0=A0=A0=A0=A0 super.setup(outputStream, parameters);<= br> where input is:
<?xml version=3D"1.0" encoding=3D"UTF-8&quo= t;?>
<angebot>
=A0 <id>$name$$angebot.id$</id>
=A0<anganz>$angebot.anganz$</anganz>
<angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschre= ibung>
</angebot>
xsl is the identity
angebot is a Hibernate Bean.
how do feed the pipeline with this Bean that it is used=A0 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>:
How can I use Jexl i= n an embadded Pipline ?

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






--089e011761836ce94a04f4813501--