Re: multi-language url rewiting. Is it possible?

Splash Forums PrettyFaces Users multi-language url rewiting. Is it possible? Re: multi-language url rewiting. Is it possible?



I’ve installed pretty-faces very quickly, that’s very nice.

I’ve just used this configuration for my project and I experienced behaviours I was not expected.

I’m trying with my eclipse project which adds the context “mtc” which will not be there on production (where the web app is on root of jetty server).

This is the configuration:

<pretty-config xmlns=""

<url-mapping id="base">
<pattern value="/#{localeChanger.languageCode}/main" />
<url-mapping id="welcome" parentId="base">
<pattern value="/welcome" />
<view-id value="/pages/main/welcome.jsf" />


In the web.xml:


and the pretty-faces filter is the first one configured as in the documentation.

Here is the behaviour:

1) when I enter http://localhost:8080/mtc/ the browser displays the default page

http://localhost:8080/mtc/pages/main/welcome.jsf (I expected http://localhost:8080/mtc/it/main/welcome instead, is there a way to fulfill my use case?)

2) in this page there is a link to itself: the link (out-bound request, as far as I understand) navigates to tha same url

http://localhost:8080/mtc/pages/main/welcome.jsf (I expected again http://localhost:8080/mtc/it/main/welcome. As I’m not using dynaview, why out-bound does not work? )

3) when I enter http://localhost:8080/mtc/en/main/welcome the mapping works well and the page is displayed (in-bound request)

4) in this situation the link to the same page returns

http://localhost:8080/mtc/pages/main/welcome.jsf (instead of http://localhost:8080/mtc/en/main/welcome, why?)

So, to be clearer, I would like to have the following behaviour:

1) the user types

1.a – http://localhost:8080/mtc/ (in my development environment) or

1.b – (in production)

and the rewritten url should be

1.a – http://localhost:8080/mtc/it/main/welcome

1.b –

2) the link in welcome page , which internally is

<h:outputLink value="../../pages/main/welcome.jsf">
<h:outputText value="#{}" />

should show the url:

1.a – http://localhost:8080/mtc/it/main/welcome

1.b –

Maybe there is still something missing somewhere, what is wrong?