Re: Complex URL schema with i18n and l10n

Splash Forums Rewrite Users Complex URL schema with i18n and l10n Re: Complex URL schema with i18n and l10n



Wow cool, good news!

If think the most complex part of our needs is the optional part at the beginning of the path.

For the subdomain part, the showcase is quite explicit and a rule like this should do the job :

public Configuration getConfiguration(final ServletContext context) {
return ConfigurationBuilder

With this kind of bean :

// (we are using CDI instead of JSF container)
public class ClientStuff implements Serializable {

private String subdomain;

public String getSubdomain() {
return this.subdomain;

public void setSubdomain(String subdomain) {
// BTW, when testing, this setter is called twice (a System.out.println would produce 2 output for a call on for example)
this.subdomain = subdomain;

When testing I made an other HttpConfigurationProvider for other mappings :

public Configuration getConfiguration(ServletContext t) {
return ConfigurationBuilder.begin()
/* And so on ... */;

Which would work flawlessly for :

(And so on)

Now for the optional part of the path for the language I’m clueless.

Let’s stick with Switzerland example, we know that subdomain “ch” would involve 4 possibilities :

de, it, fr and rm =>

(And so on)

I need to get the “de” or “it” without confusing with the “login” information.

Shall I add a ConfigurationProvider that would act “between” the domain configuration and the path configuration?

Ooh, while writing an idea comes to me, I could inject my ClientStuff in my configuration provider and rebuild the rules but I’m afraid to loose some flexibility. I’ll give a try and come back with what I did.

Thanks for your answer!