Re: Using Wicket to generate E-Mails.

2019-03-12 Thread Thorsten Schöning
Guten Tag Martin Grigorov,
am Dienstag, 12. März 2019 um 17:12 schrieben Sie:

> To render more complex markup you need to use ComponentRenderer.
> You can render whole Pages or just Components (like Panels).

Great, I'll have a look at that.

> I do not understand what you mean with `adding newlines, manual
> indentation, etc.` - Wicket just renders whatever your page/panel says.

My HTML-templates would contain elements like "h1", "p", "table",
"pre", "blockquote" etc., which are not useful as is in plain text
mails. Consider the following pseudo-HTML:

Hi customer!
Good news for you...
NEW PRICE: 10 bucks
You said...

That should be rendered to something like the following:

Hi customer!

Good news for you...

 NEW PRICE: 10 bucks

> You said...

But that should be achievable using Component.setRenderBodyOnly and
pre-/post-processing the results of ComponentRenderer. Two slightly
different render approaches using the same templates in best cases.

> ComponentRenderer just sets up a dummy RequestCycle so that you can render
> in non-HTTP threads, i.e. background threads.

Which is exactly what I need. Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Using Wicket to generate E-Mails.

2019-03-12 Thread Martin Grigorov
Guten Tag,

On Tue, Mar 12, 2019 at 5:57 PM Thorsten Schöning 
wrote:

> Guten Tag Martin Grigorov,
> am Dienstag, 12. März 2019 um 15:18 schrieben Sie:
>
> > There is an example how to do this in wicket-examples:
> > - http://examples8x.wicket.apache.org/mailtemplate/
> > -
> https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/asemail
>
> Thanks, looking at PackageTextTemplate, it doesn't provide any support
> for tables, lists etc.? Only replacement of key-value-pairs?
>

Correct!


>
> If I want to use HTML-templates only at best, do I need to
> additionally look at ComponentRenderer? "Component.setRenderBodyOnly"
> in combination with adding newlines, manual indentation etc. on the
> result of the rendering?
>

To render more complex markup you need to use ComponentRenderer.
You can render whole Pages or just Components (like Panels).
I do not understand what you mean with `adding newlines, manual
indentation, etc.` - Wicket just renders whatever your page/panel says.

ComponentRenderer just sets up a dummy RequestCycle so that you can render
in non-HTTP threads, i.e. background threads.


>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
> AM-SoFT IT-Systeme  http://www.AM-SoFT.de/
>
> Telefon...05151-  9468- 55
> Fax...05151-  9468- 88
> Mobil..0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Using Wicket to generate E-Mails.

2019-03-12 Thread Thorsten Schöning
Guten Tag Martin Grigorov,
am Dienstag, 12. März 2019 um 15:18 schrieben Sie:

> There is an example how to do this in wicket-examples:
> - http://examples8x.wicket.apache.org/mailtemplate/
> - 
> https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/asemail

Thanks, looking at PackageTextTemplate, it doesn't provide any support
for tables, lists etc.? Only replacement of key-value-pairs?

If I want to use HTML-templates only at best, do I need to
additionally look at ComponentRenderer? "Component.setRenderBodyOnly"
in combination with adding newlines, manual indentation etc. on the
result of the rendering?

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Using Wicket to generate E-Mails.

2019-03-12 Thread Martin Grigorov
Hi,

There is an example how to do this in wicket-examples:
- http://examples8x.wicket.apache.org/mailtemplate/
-
https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/asemail

On Tue, Mar 12, 2019 at 4:05 PM Thorsten Schöning 
wrote:

> Hi all,
>
> I'm using Wicket for some frontend of some web app and pretty much
> like it because it allows me to clearly separate skins, language
> files, templates and to not mix too much view and business logic. My
> current requirements are to send mails in some web service backend and
> I want to use some template engine to generate those, because I need
> to support multiple languages, might need to create somewhat complex
> content like tables, headlines and stuff. Not only using HTML, but
> using plain text as well.
>
> I've already searched around that topic focussing on Wicket and found
> some explanations that this in fact is doable, but those references
> are pretty old already. The following are some examples:
>
> http://wicket-praxis.de/blog/2009/12/01/sending-html-email-from-wicket-app/
>
> https://cwiki.apache.org/confluence/display/WICKET/Use+wicket+as+template+engine
>
> Are there any newer docs available covering that topic I have missed?
>
> What I'm especially interested in is how to avoid the HTTP-stuff, what
> the entry points are if I want to render to some string only and what
> the best approach is to provide necessary data like different language
> settings, as the corresponding HTTP-headers are missing.
>
> Another focus is on generating plain text. I know Wicket is based on
> HTML/XML-templates, but components can be rendered "body only" already
> as well. I had something in mind like reusing the templates for
> HTML-mails by not rendering them entirely including nodes, but only
> node content itself specially.
>
> Something like "..." would simply be rendered as some line of
> text with an empty line afterwards. Same for e.g. "p", while "pre"
> might simply be indented, "cite" might get a leadin ">" per line etc.
> So in the best case, I would maintain one set of templates mostly and
> two different rendering approaches to switch between.
>
> Any hints on how I need to implement those different rendering
> approaches for the same components? So that I don't need to deal with
> that for each and every component, but some visitor-rendering-pattern
> or such.
>
> Does anyone already have experience with such an approach and
> additonal advises? Is it a totally bad idea for some reason?
>
> Thanks for your input!
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
> AM-SoFT IT-Systeme  http://www.AM-SoFT.de/
>
> Telefon...05151-  9468- 55
> Fax...05151-  9468- 88
> Mobil..0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Using Wicket to generate E-Mails.

2019-03-12 Thread Thorsten Schöning
Hi all,

I'm using Wicket for some frontend of some web app and pretty much
like it because it allows me to clearly separate skins, language
files, templates and to not mix too much view and business logic. My
current requirements are to send mails in some web service backend and
I want to use some template engine to generate those, because I need
to support multiple languages, might need to create somewhat complex
content like tables, headlines and stuff. Not only using HTML, but
using plain text as well.

I've already searched around that topic focussing on Wicket and found
some explanations that this in fact is doable, but those references
are pretty old already. The following are some examples:

http://wicket-praxis.de/blog/2009/12/01/sending-html-email-from-wicket-app/
https://cwiki.apache.org/confluence/display/WICKET/Use+wicket+as+template+engine

Are there any newer docs available covering that topic I have missed?

What I'm especially interested in is how to avoid the HTTP-stuff, what
the entry points are if I want to render to some string only and what
the best approach is to provide necessary data like different language
settings, as the corresponding HTTP-headers are missing.

Another focus is on generating plain text. I know Wicket is based on
HTML/XML-templates, but components can be rendered "body only" already
as well. I had something in mind like reusing the templates for
HTML-mails by not rendering them entirely including nodes, but only
node content itself specially.

Something like "..." would simply be rendered as some line of
text with an empty line afterwards. Same for e.g. "p", while "pre"
might simply be indented, "cite" might get a leadin ">" per line etc.
So in the best case, I would maintain one set of templates mostly and
two different rendering approaches to switch between.

Any hints on how I need to implement those different rendering
approaches for the same components? So that I don't need to deal with
that for each and every component, but some visitor-rendering-pattern
or such.

Does anyone already have experience with such an approach and
additonal advises? Is it a totally bad idea for some reason?

Thanks for your input!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org