0 Replies Latest reply on Aug 12, 2010 7:38 PM by nathandennis

    Redirecting After Changing Locales

    nathandennis

      seam 2.2.0


      ran into somewhat of a dead end when internationalizing a site. problem is if you have a bunch of page parameters in the url that are needed to redirect to the same page, those page parameters are lost when localeSelector.select() just returns void.


      unlike the slick way gavin wrote the org.jboss.seam.faces.Redirect, there is no event raised before the user decides to change the locale for us to capture the current URL and handle all the parameters. using something like Redirect and overriding localeSelector.select will return not only the url with the page parameters but the addition faces component information for that request. dont need to build one of those to know it isnt going to redirect properly.


      is there any good reason,,, from a conversation standpoint that we couldnt add something simple using FacesManager to the select() method that would return us easily to the originating page???



      
      public void select() {//LocaleSelector.select();
      ...
          FacesManager.instance().redirectToExternalURL(getRequest().getHeader("referer"));
      }
      
      public static HttpServletRequest getRequest() {    
          return (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
        }