vendredi 6 mars 2015

JavaEE web resource collection - URL pattern odd behavior with "/"



To the point, here are some of my files:




  1. web.xml



    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/error.jsp</form-error-page>
    </form-login-config>
    </login-config>

    <security-constraint>
    <web-resource-collection>
    <web-resource-name>fixmyhome</web-resource-name>
    <url-pattern>/</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
    </security-constraint>

    <security-role>
    <role-name>*</role-name>
    </security-role>

    <servlet>
    <servlet-name>SecurityServlet</servlet-name>
    <servlet-class>com.jaas.security.servlet.SecurityServlet</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>SecurityServlet</servlet-name>
    <url-pattern>/SecurityServlet</url-pattern>
    </servlet-mapping>



  2. login.jsp



    <head>
    <title>Fix My Home</title>
    </head>
    <body>
    <form method="post" action="./SecurityServlet">
    User ID: <INPUT type="text" name="j_username" /> <br /> Password : <INPUT
    type="password" name="j_password" /> <br /> <INPUT type="submit"
    value="Submit" />
    </form>
    </body>



Note: The context is fixmyhome


Here's the steps i worked on:

- Type http://localhost:8080/fixmyhome/ on browser

- Enter user id and password and submit

- The URL changes to http://localhost:8080/fixmyhome/SecurityServlet

- The doPost method on the SecurityServlet never got invoked


I would appreciate any insight into this.

Thanks.




Aucun commentaire:

Enregistrer un commentaire