Thanks a lot!

-------- Original-Nachricht --------
> Datum: Mon, 27 Oct 2008 13:33:54 +0100
> Von: Christian Gorbach <[EMAIL PROTECTED]>
> An: Tapestry users <users@tapestry.apache.org>
> Betreff: Re: [T5] How to overwrite the Locale (domain specific)

> implement a filter like:
> 
> public class HostBasedLocaleFilter implements RequestFilter {
> 
>     private Map<String, Locale> serverNameMapping;
> 
>     private Locale defaultLocale;
> 
>     private ThreadLocale threadLocale;
> 
>     public HostBasedLocaleFilter(final ThreadLocale threadLocale, final 
> Locale defaultLocale,
>             final Map<String, Locale> serverNameMapping) {
>         this.serverNameMapping = serverNameMapping;
>         this.defaultLocale = defaultLocale;
>         this.threadLocale = threadLocale;
>     }
> 
>     public boolean service(Request request, Response response, 
> RequestHandler handler) throws IOException {
>         String servername = request.getServerName();
>         Locale locale = this.serverNameMapping.get(servername);
>         if (locale == null) {
>             locale = this.defaultLocale;
>         }
>         threadLocale.setLocale(locale);
>         return handler.service(request, response);
>     }
> 
> }
> 
> 
> and add the filter to contributeRequestHandler  in your module
> 
> ...
>         configuration.add("HostBasedLocalization", new 
> HostBasedLocaleFilter(threadLocale, Locale.GERMAN, serverNameMappings),
>                 "after:Localization");
> 
> ..
> 
> that's itn - cheers
> c)hristian
> 
> > I have already asked before, but maybe nobody has read it ;-)
> >
> > I still have not found a solotion how to set the Locale in Tapestry5
> depending on the domain name/subdomain.
> >
> > In Tapestry4 using Hivemind, the ThreadLocale could be injected into a
> service etc...
> >
> > In Tapestry5 + Spring I don't know how this can be done.
> >
> > Is there a documentation somewhere which services exist in Tapestry5 and
> how they can be accessed?
> >
> > I am missing some documentation on the different methods and name
> conventions inside the AppEngine ....
> >
> > Thanks!
> >
> > Toby
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to