Re: multi-language url rewiting. Is it possible?
It seems like the redirecting doesn’t work from your action method. First you could try to replace
encodeActionURL because I’m no sure if the former once calls the required Servlet APIs for the rewriting to work correctly.
Another problem may be that you are using
getRequestServletPath(). This one doesn’t refer to a JSF view id, so this won’t work. You current code returns something like this:
This is not a valid JSF outcome because it doesn’t refer to a viewId. It should be something like this:
But you could also try to just manually redirect to the correct URL. Something like this:
String oldPath = PrettyContext.getCurrentInstance().getRequestURL().toString();
String newPath = oldPath.replace("/it/", "/en/");
FacesContext ctx = FacesContext.getCurrentInstance();
String contextPath = ctx.getExternalContext().getRequestContextPath();
replace path should be implemented differently.