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 32CE110582 for ; Fri, 14 Mar 2014 09:57:29 +0000 (UTC) Received: (qmail 5082 invoked by uid 500); 14 Mar 2014 09:57:27 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 4614 invoked by uid 500); 14 Mar 2014 09:57:25 -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 4607 invoked by uid 99); 14 Mar 2014 09:57:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 09:57:22 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [212.82.96.136] (HELO nm8-vm2.bullet.mail.ir2.yahoo.com) (212.82.96.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 09:57:17 +0000 Received: from [212.82.98.50] by nm8.bullet.mail.ir2.yahoo.com with NNFMP; 14 Mar 2014 09:56:54 -0000 Received: from [46.228.39.98] by tm3.bullet.mail.ir2.yahoo.com with NNFMP; 14 Mar 2014 09:56:54 -0000 Received: from [127.0.0.1] by smtp135.mail.ir2.yahoo.com with NNFMP; 14 Mar 2014 09:56:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1394791014; bh=RK8YIayEow23mK0AiDthYRGXFVRRJHWFotNhogmX2Po=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type; b=tBjhUrLJRnC8rY3Kp3Rxj+xzBIhzwARRu/GguYdvC1HVYJNdit/DibgpT3qI+J2AgqegwM5sfaVanOtZqwpStZz4MK/osQHN28UDQbvWf7NT5PRkWX/6qdf1T5VZrMjBZl6vBSuabJDKzypu4uXhVzuWY1+bmXMX0A4EJ9wXhmo= X-Yahoo-Newman-Id: 842845.29011.bm@smtp135.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-5 X-YMail-OSG: 8Udv8pUVM1m3AzbuF6DirDQKL3WN.Dlc8S0FhW6wh21EkMi DQopwvVbg4A.kV.Fz2uhyZO6Vs2aD3gvvioXlRN51AfXnrYRh5i0iaBDAjZx 2IB5cBkHpYIwK31Se.EnQRCpdsO.3TArTsSS.iwF3_wVcuiJd5DQHXzid_9k yUqivsznq6yjwLoAklLE_HHx6ADafuglCrphqleK6sujPqgWc_Zt6t0RXQbY zPdUsS73Nb3YERMbDDQKT7X.ZpwLDIU2Fguz59JZC4yaOLZv_tqduhE6nDwd bdCetGhjogRjyD4g23dz0PW.4dDF8okxJRIBhD69i2gdnZFngpaxsw32QoIt 76HtutnFd_4PCMmVhDReeCrGWbixE75l_YdEuFx_KzxGqT6_9mn2bufTMyBN 49kb5CoNcwUaQovPcnG8K4R0I0DjjrUj6dy.fS205Zx1nReJy5Hd6SWoep_W 3vcOgt2BclL63NKfwvg05tfTCQn5IF2pRRiT5fNlTbRqOADmQvUmN3f95yjo J79M8YxF9cT0.yYH45Dh7JmDSaAB6VsSZroXFw489XUKjlh6bNOjUrU09834 86xOa.GTjKwqDiIE5Yip7a55KQwvqi9KUB18t2DgOV9WCt6xjYGSgUxrKvYH hCXtSGNWyH07URg0QQL85k7jjOgPgUJGxOQwSjgIVu3OWZlZCTLgDp5KVZYA fSc6a0kPmXIPaTFBoqQ2yZobE3RYjqYxp38OhmxtRpDgvcCq38jvOF2ADr4x oOZ1kTPNUhLHZmGG_w_ZI31GJilmq9VP4GQ_ERBAWlM5pMBUgAWHAI7Frt5g infGFre1qIpUJuNrM_X3.qlZbPzQ3 X-Yahoo-SMTP: yxbNXPWswBAlrg8tAOg0RpIwMcOTVqlEn8R052g3 X-Rocket-Received: from [192.168.178.25] (hansheinrichbraun@77.187.32.169 with plain [188.125.69.59]) by smtp135.mail.ir2.yahoo.com with SMTP; 14 Mar 2014 09:56:54 +0000 UTC Message-ID: <5322D265.4050607@yahoo.de> Date: Fri, 14 Mar 2014 10:56:53 +0100 From: Yahoo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Jexl in embedded Pipeline 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> <53229014.7020708@yahoo.de> In-Reply-To: Content-Type: multipart/alternative; boundary="------------000704030402000003090803" X-Virus-Checked: Checked by ClamAV on apache.org --------------000704030402000003090803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit You are right. The only reason I didn't leave Cocoon is its automatic production of pdf from xml. The surrounding became very tediously. I just found out that there is some difference between Jexl and Velocity expressions. But I think I can now try to upgrade my former cocoon email adaption. 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 >: > > 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("webmaster@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 >> >: >> >> 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): >>> >>> >>> >>> >>> >>> >>> >>> @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 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 >>>> >>>> >>>> >>> >>> >> >> > > --------------000704030402000003090803 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit You are right. The only reason I didn't leave Cocoon is its automatic production of pdf from xml.
The surrounding became very tediously.
I just found out that there is some difference between Jexl and Velocity expressions.
But I think I can now try to upgrade my former cocoon email adaption.

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 <hansheinrichbraun@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("webmaster@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 <hansheinrichbraun@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 <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$</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>:
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









--------------000704030402000003090803--