10 Replies Latest reply on Jul 23, 2012 9:29 AM by Jochen Riedlinger

    cannot get original request URI on JSF2 based form login page

    Jochen Riedlinger Newbie

      Hi,

       

      I try to implement a JSF2 login page for container form based authentication

       

      in my web.xml I have this configuration:

       

       

      {code:xml}

      <login-config>

             <auth-method>FORM</auth-method>

             <realm-name>CustomRealm</realm-name>

             <form-login-config>

                 <form-login-page>/login.jsf</form-login-page>

                 <form-error-page>/login.jsf</form-error-page>

             </form-login-config>

         </login-config>

      {code}

       

      In my backing bean for login.xhtml I tried to get the original URI for redirecting after successful login like this:

       

       

      {code}

      String uri = externalContext.getRequestMap().get("javax.servlet.forward.request_uri");

      {code}

       

      Unfortunateyl this returns nothing;-(

       

       

      I also tried to get the URI directly in the view page, instead of the backing bean,

       

      {code:xml}

      #{requestScope['javax.servlet.forward.request_uri']}

      {code}

      but I also get an empty result here.

       

      I found several sites which state that it should work this way....but not for me;-(

       

      e.g.

      [http://stackoverflow.com/questions/8024344/user-login-with-jsf-2-0]

      [http://stackoverflow.com/questions/5144186/redirect-to-protected-resource-or-original-saved-request-after-servlet-3-0-https]

      [https://community.jboss.org/message/129648#129648]

       

       

      Do you have any ideas how to achieve want I want to? Or is that a bug in JBoss 7?

       

      Thanks,

      Jochen