10 Replies Latest reply on Feb 13, 2014 2:53 PM by oortdg

    Login with jsf form servers rfRes/skinning.ecss.xhtml page

    oortdg

      HI all,

       

      Starting an project with an jsf login page servers rfRes/skinning.ecss.xhtml page. Although I've seen it before, the page about this issue couldn't be found anymore because the forum could not be found.

      So:

       

      I've an login page :

      (login.xhtml)

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:h="http://java.sun.com/jsf/html" >

       

       

      <h:head>

          <title>  JSF 2 Login </title>

      </h:head>

      <h:body>

          <p>Login to access secure pages:</p>

          <form method="post" action="j_security_check">

              <h:panelGrid columns="2">

                  <h:outputLabel for="j_username" value="Username" />

                  <input type="text" id="j_username" name="j_username" />

                  <h:outputLabel for="j_password" value="Password" />

                  <input type="password" id="j_password" name="j_password" />

                  <input type="submit" name="submit" value="Login" />

              </h:panelGrid>

              <br />

          </form>

      </h:body>

      </html>

       

      and web.xml:

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

      <welcome-file-list>

          <welcome-file>/pages/index.xhtml</welcome-file>

        </welcome-file-list>

        <security-constraint>

          <display-name>login</display-name>

          <web-resource-collection>

            <web-resource-name>Wildcard means whole app requires authentication</web-resource-name>

            <url-pattern>/*</url-pattern>

            <http-method>GET</http-method>

            <http-method>POST</http-method>

          </web-resource-collection>

          <auth-constraint>

            <role-name>admin</role-name>

          </auth-constraint>

          <user-data-constraint>

            <transport-guarantee>NONE</transport-guarantee>

          </user-data-constraint>

        </security-constraint>

        <login-config>

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

          <realm-name>MyRealm</realm-name>

          <form-login-config>

            <form-login-page>/pages/login.xhtml</form-login-page>

            <form-error-page>/pages/login-failed.html</form-error-page>

          </form-login-config>

        </login-config>

        <security-role>

          <role-name>admin</role-name>

        </security-role>

      <!-- JavaServer Faces Servlet -->

        <servlet>

          <servlet-name>Faces Servlet</servlet-name>

          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

          <load-on-startup>1</load-on-startup>

        </servlet>

       

        <!-- Servlet Mapping to URL pattern -->

        <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.xhtml</url-pattern>

        </servlet-mapping>

         <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.jsf</url-pattern>

        </servlet-mapping>

         <servlet-mapping>

          <servlet-name>Faces Servlet</servlet-name>

          <url-pattern>*.faces</url-pattern>

        </servlet-mapping>

      </web-app>

      and an simple index.xhtml:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:h="http://java.sun.com/jsf/html"

            xmlns:a4j="http://richfaces.org/a4j"

            xmlns:rich="http://richfaces.org/rich"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:ui="http://java.sun.com/jsf/facelets">

       

      <h:head></h:head>

      <body>

          <rich:panel>

              <f:facet name="header">

              Write your own custom rich components with built-in AJAX support

              </f:facet>

              <h2>hello</h2>

          </rich:panel>

      </body>

      </html>

       

       

      and jboss-web.xml:

      <jboss-web>

            <security-domain>MyRealm</security-domain>

      </jboss-web>

       

      nothing special.

       

      When the login page is an normal html file the application runs fine, but when the loginpage is an jsf file as described above i get rfRes/skinning.ecss.xhtml page:

       

      Unexpected_page.png

       

      richfaces version: 4.3.4.Final

      server jboss 7.1 and wildfly-8.0.0.Beta1 both the same problems

       

      Is there an solution for this?

        • 1. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
          bleathem

          What if you drop the *.xhtml mapping and change your loging and welcome pages to use the *.jsf extension?

          • 2. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
            rhanus

            it's known problem but hopefully a workaround exists

            see this jira issue for details

            1 of 1 people found this helpful
            • 3. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
              oortdg

              using the mapping /faces/  doesn't solve the problem. Also cleaning the history, doesn't work.

              • 4. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                rhanus

                sure ?

                 

                <servlet-mapping>

                  <servlet-name>Faces Servlet</servlet-name>

                <!-- <url-pattern>*.xhtml</url-pattern> -->

                  <url-pattern>/faces/*</url-pattern>

                  </servlet-mapping>

                  <welcome-file-list>

                <!-- <welcome-file>home.xhtml</welcome-file> -->

                  <welcome-file>faces/home.xhtml</welcome-file>

                  </welcome-file-list>

                • 5. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                  oortdg

                  Sure !! The only workaround that works is to not use an login jsf page.

                   

                  -----------------

                   

                   

                    <!-- JavaServer Faces Servlet -->

                    <servlet>

                      <servlet-name>Faces Servlet</servlet-name>

                      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

                      <load-on-startup>1</load-on-startup>

                    </servlet>

                   

                    <!-- Servlet Mapping to URL pattern -->

                       <servlet-mapping>

                          <servlet-name>Faces Servlet</servlet-name>

                          <url-pattern>/faces/*</url-pattern>

                      </servlet-mapping>

                  • 6. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                    rhanus

                    but for me it works like a charm

                    • 7. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                      oortdg

                      Ok reading the jira RF-11309 (https://community.jboss.org/message/845773?et=watches.email.thread#845773 ) and saw that removing the richfaces jars from the war the problem solves. Changed my pom richfaces dependencies into

                       

                              <dependency>
                                  <groupId>org.richfaces.ui</groupId>
                                  <artifactId>richfaces-components-ui</artifactId>
                                  <scope>provided</scope>
                              </dependency>
                              <dependency>
                                  <groupId>org.richfaces.core</groupId>
                                  <artifactId>richfaces-core-impl</artifactId>
                                  <scope>provided</scope>
                              </dependency>

                      and everything works as expected

                      • 8. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                        oortdg

                        unfortunately richfaces doesn't start so the issue is still there. so, at least with maven, it is not possible to redirect from an login jsf2 page to an richfaces page.

                        • 9. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                          bleathem

                          The use case you are describing should be achievable.  Can you provide a Short, Self Contained, Correct (Compilable), Example demonstrating where you are having trouble?

                          • 10. Re: Login with jsf form servers rfRes/skinning.ecss.xhtml page
                            oortdg

                            What is an good reproduction scenario without a lot of garbage. What is the smallest pom.xml for richfaces. After reading the development guid for richfaces i got an idea. Lets make an project created with maven. So i used :

                            mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes -DarchetypeArtifactId=richfaces-archetype-simpleapp -DarchetypeVersion=4.2.2.Final -DgroupId=org.docs.richfaces -DartifactId=loginProblem


                            The project that is generated is known by the richfaces developers and i have the smallest pom i can create for an richfaces project.

                             

                            With this approche i created two projects The first one loginProblem1 has an html login-page, with is handled correctly by an jboss server (in this case the wildfly 8.0 final)

                             

                            The second project has an xhtml login-page is the same as project 1 but now with an <h:head > </h:head> in it.

                             

                            And the third project is an copy of the second but now the richfaces dependencies are removed from the pom.

                             

                            All the three projects are deployed on a wildfly 8.0 final and using the ApplicationRealm with an user = testUser and a password T_123456789 and having the role admin and build outside eclipse using mvn build install (maven 3)

                             

                            The results are project 1 login proceed without problems

                            disable deployment

                            project 2 gives the page as mention in the screendump from 3 months ago

                            remove deployment

                            deploy project 3 and the result is an succesfull login but now the index.xhtml gives an warning because richfaces jars are not in this deployment any more.

                             

                            So my conclusion Using an jsf loginpage with richfaces is not possible, but is possible with only using jsf 2.0

                             

                            Can somebody look at this, i think it is an bug.

                             

                            (i'm not shure how to upload an zip i don't see any posibility i will try this after this comment otherwise i can mail them to anybody who want to look in it.