0

i am developing on two different machines with almost the same specs (Win 7, eclipse juno, tomcat 7) and the source checked out from github.

But on my laptop i have a different url behaviour than on my workstation. Entering

http://localhost:8080/jeiwomisa/auth/login.xhtml 

works on my laptop but not my workstation.

On my workstation i have to use:

http://localhost:8080/jeiwomisa/faces/auth/login.xhtml

The difference is the "/faces/" part. This is the same for all links. I dont understand that as i think i have the same configuration on both machines.

I am not sure which configuration exactly is needed for this problem, so i just post my web.xml:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>


<!-- -->
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/app/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<!-- pretty faces -->

<filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>Pretty Filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>


<context-param>
    <param-name>com.ocpsoft.pretty.BASE_PACKAGES</param-name>
    <param-value>de.sveri.jeiwomisa.managed</param-value>
</context-param>

<!-- Project Stage Level -->
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>

<!-- JSF Servlet is defined to container -->
<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>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>

And this is my security-app-context.xml where the login.xhtml is defined:

<http use-expressions="true" auto-config="true">
    <intercept-url pattern="/test/**" access="permitAll" />
    <intercept-url pattern="/tasks/**" access="isAuthenticated()" />

    <!-- <intercept-url pattern="/**" access="denyAll" /> -->
    <form-login login-page="/auth/login.xhtml" />   
</http>

<context:annotation-config />
<b:bean id="userRepositoryImpl" class="de.sveri.jeiwomisa.model.UserRepositoryImpl"
    autowire="byType">
</b:bean>

<b:bean id="passwordEncoder"
    class="org.springframework.security.crypto.password.StandardPasswordEncoder">
</b:bean>


<authentication-manager>
    <authentication-provider user-service-ref="userRepositoryImpl">
            <password-encoder hash="md5" />
    </authentication-provider>
</authentication-manager>

If you need to you can find the complete code at: github code

Best Regards, Sven

sveri
  • 1,372
  • 1
  • 13
  • 28

2 Answers2

0

you should add servlet mapping for both applications. try to add following code to youe web.xml file.

    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
erencan
  • 3,725
  • 5
  • 32
  • 50
0

Strange. Try clearing your browser cache? Your configuration certainly appears correct.

Lincoln
  • 3,151
  • 17
  • 22