Locale in ComponentRequestFilter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Locale in ComponentRequestFilter

nquirynen
Hi,

I need the Locale inside an implementation of ComponentRequestFilter. So
I injected Request and use Request.getLocale(). But it seems that this
will always return the default locale (browser locale ?). I guess this
is because the setting of the locale happens after my component request
filters (PageRenderDispatcher ?).

In Request.getPath() I can see the locale I need though, so I could get
it using substring method.

I'm just wondering if I'm right in my conclusions and if using
request.getPath() is the only (and right) way to get what I want?

Greetings,
Nathan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Locale in ComponentRequestFilter

nquirynen
I think I found what I need: PersistentLocale

So I just inject PersistentLocale in my component request filter and
this seems to give what I need :)

So I'm guessing the locale in the request is always what was sent by the
client (browser locale) and not what has been set in the application?

On 25/06/15 13:36, Nathan Quirynen wrote:

> Hi,
>
> I need the Locale inside an implementation of ComponentRequestFilter.
> So I injected Request and use Request.getLocale(). But it seems that
> this will always return the default locale (browser locale ?). I guess
> this is because the setting of the locale happens after my component
> request filters (PageRenderDispatcher ?).
>
> In Request.getPath() I can see the locale I need though, so I could
> get it using substring method.
>
> I'm just wondering if I'm right in my conclusions and if using
> request.getPath() is the only (and right) way to get what I want?
>
> Greetings,
> Nathan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]