Hi Kristian,

Thanks for the reply,  my need is not to get the locale from the request
but, I have two domain names, all will point to the same IP, one domain will
have 'en' as locale while another one will have 'zh' as its locale, your
solution works except I have to find out first the domain name before
setting the locales.
Thanks,

A.C


kristian.marinkovic wrote:
> 
> ok... just tried it myself... i get the same exception....
> if you move your method call to getLocale it works.
> 
> another option is to write a Dispatcher that reads the
> locale from the request and sets it in the ThreadLocale:
> 
> public class LocaleDispatcher implements Dispatcher {
>     private final ThreadLocale locale;
>     public LocaleDispatcher (ThreadLocale locale) {
>         this.locale=locale;
>     }
> 
>     public boolean dispatch(Request request, Response response) throws 
> IOException {
>         locale.setLocale(request.getLocale());
>         return false;
>     }
> 
> }
> 
> 
> 
> 
> g,
> 
> kris
> 
> 
> 
> 
> Kristian Marinkovic <[EMAIL PROTECTED]> 
> 18.12.2007 12:13
> Bitte antworten an
> "Tapestry users" <users@tapestry.apache.org>
> 
> 
> An
> "Tapestry users" <users@tapestry.apache.org>
> Kopie
> 
> Thema
> Antwort: Re: T5: Domain level localization
> 
> 
> 
> 
> 
> 
> can you show me how you define your DomainThreadLocale service in 
> your module class?
> 
> 
> 
> 
> Angelo Chen <[EMAIL PROTECTED]> 
> 18.12.2007 11:33
> Bitte antworten an
> "Tapestry users" <users@tapestry.apache.org>
> 
> 
> An
> users@tapestry.apache.org
> Kopie
> 
> Thema
> Re: T5: Domain level localization
> 
> 
> 
> 
> 
> 
> 
> 
> Hi Kristian,
> 
> This is a old post, i finally tried it out, it works, but how to check
> domain name? calling 'request' s method cause exceptions, example:
> 
>    System.out.println(request.getContextPath());
> 
> ERROR] RequestExceptionHandler Processing of request failed with uncaught
> exception: Error invoking constructor
> org.bfe.myapp.t5.DomainThreadLocale(Request) (at 
> DomainThreadLocale.java:42)
> (for service 'domainThreadLocale'): java.lang.NullPointerException
> java.lang.RuntimeException: Error invoking constructor
> org.bfe.myapp.t5.DomainThreadLocale(Request) (at 
> DomainThreadLocale.java:42)
> (for service 'domainThreadLocale'): java.lang.NullPointerException
>                  at
> org.apache.tapestry.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:65)
> 
> 
> kristian.marinkovic wrote:
>> 
>> you could create your own ThreadLocale object that has
>> 
>> 
>> DomainThreadLocale implements ThreadLocale {
>>      public DomainThreadLocale (Request request) {
>>      // check domain and set locale....
>>      } 
>> }
>> 
>> 
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/T5%3A-Domain-level-localization-tp13032958p14391706.html
> 
> 
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Domain-level-localization-tp13032958p14396833.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to