0

Im building a site with JSF and i need to have the following urls:

www.---.com/domain1/page.jsf
www.---.com/domain2/page.jsf
...
www.---.com/domainN/page.jsf

In ASP.NET i was able to do that this way:

routes.MapRoute(
    name: "Default",
    url: "{domain}/{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });

I have tried using http://www.ocpsoft.org/rewrite/ like this:

.addRule(Join.path("/{domain}/clients/{page}").to("/clients/{page}.jsf"));

but the effect its not the same. For example when redirecting to another page inside a beans method with:

return "page?faces-redirect=true";

the url generated by that does not contain the domain part. I cant also get the domain part from the request url because its not there. How else can i achieve this?

Thanks

Fabricio
  • 15
  • 4
  • why not use return "/domain/page?faces-redirect=true";? – Ced Oct 05 '15 at 03:35
  • i cant get the domain in the bean. Getting the request from the external context returns an url without the /domain/ part, because its changed by the rewrite api. I also tried using request.getAttribute("javax.servlet.forward.request_uri"); but sometimes it is null, idk why. – Fabricio Oct 06 '15 at 01:42

0 Answers0