我想包括“春季安全3.2.0”到被无弹簧内置已有的Web应用程序和使用Primefaces & EJB 3春季安全3.2 - CSS显示问题
当我开始与基本配置,并尝试访问没有CSS样式的页面显示。以下日志包含有关路径的一些信息。我不知道我错过了什么。
非常感谢提前。
应用程序日志: -
05-02-2014 16:05:58 INFO DispatcherServlet:472 - FrameworkServlet 'spring': initialization completed in 831 ms
05-02-2014 16:05:58 DEBUG DispatcherServlet:141 - Servlet 'spring' configured successfully
05-02-2014 16:05:58 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing GET request for [/myapp/resources/css/myapp.css]
05-02-2014 16:05:58 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing GET request for [/myapp/resources/images/bg_myapp_header.gif]
05-02-2014 16:05:58 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing GET request for [/myapp/resources/js/myapp.js]
05-02-2014 16:05:58 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing GET request for [/myapp/resources/images/2_arial_white_myapp_bg.png]
05-02-2014 16:05:58 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing GET request for [/myapp/resources/images/logo.png]
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:209 - Looking up handler method for path /resources/css/myapp.css
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:209 - Looking up handler method for path /resources/js/myapp.js
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:219 - Did not find handler method for [/resources/js/myapp.js]
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:209 - Looking up handler method for path /resources/images/bg_myapp_header.gif
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:209 - Looking up handler method for path /resources/images/2_arial_white_myapp_bg.png
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:209 - Looking up handler method for path /resources/images/eba_logo.png
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:219 - Did not find handler method for [/resources/images/2_arial_white_myapp_bg.png]
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:219 - Did not find handler method for [/resources/images/bg_myapp_header.gif]
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:219 - Did not find handler method for [/resources/css/myapp.css]
05-02-2014 16:05:58 WARN PageNotFound:1108 - No mapping found for HTTP request with URI [/myapp/resources/images/bg_myapp_header.gif] in DispatcherServlet with name 'spring'
05-02-2014 16:05:58 WARN PageNotFound:1108 - No mapping found for HTTP request with URI [/myapp/resources/images/2_arial_white_myapp_bg.png] in DispatcherServlet with name 'spring'
05-02-2014 16:05:58 WARN PageNotFound:1108 - No mapping found for HTTP request with URI [/myapp/resources/js/myapp.js] in DispatcherServlet with name 'spring'
05-02-2014 16:05:58 DEBUG RequestMappingHandlerMapping:219 - Did not find handler method for [/resources/images/logo.png]
05-02-2014 16:05:58 DEBUG HttpSessionSecurityContextRepository:300 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
05-02-2014 16:05:58 DEBUG HttpSessionSecurityContextRepository:300 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
05-02-2014 16:05:58 DEBUG HttpSessionSecurityContextRepository:300 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
05-02-2014 16:05:58 WARN PageNotFound:1108 - No mapping found for HTTP request with URI [/myapp/resources/css/myapp.css] in DispatcherServlet with name 'spring'
05-02-2014 16:05:58 DEBUG DispatcherServlet:946 - Successfully completed request
05-02-2014 16:05:58 DEBUG DispatcherServlet:946 - Successfully completed request
05-02-2014 16:05:58 DEBUG DispatcherServlet:946 - Successfully completed request
05-02-2014 16:05:58 WARN PageNotFound:1108 - No mapping found for HTTP request with URI [/myapp/resources/images/logo.png] in DispatcherServlet with name 'spring'
弹簧的security.xml
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
<authentication-manager>
<authentication-provider>
<user-service>
<user name="jay" password="jay" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
<http pattern="/resources/css/**" security="none" />
<http pattern="/resources/images/**" security="none" />
<http pattern="/resources/js/**" security="none" />
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/faces/javax.faces.resource/**" access="permitAll" />
<intercept-url pattern="/faces/login.xhtml" access="permitAll" />
<intercept-url pattern="/faces/search.xhtml" access="permitAll" />
<intercept-url pattern="/faces/create.xhtml" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/faces/update.xhtml" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/**" access="permitAll" />
</http>
</beans:beans>
弹簧servlet.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<mvc:annotation-driven />
<import resource="spring-security.xml" />
<mvc:resources location="/css/**" mapping="/resources/css/" />
<mvc:resources location="/images/**" mapping="/resources/images/" />
<mvc:resources location="/js/**" mapping="/resources/js/" />
</beans>
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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<!-- JSF configuration -->
<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>/faces/*</url-pattern>
</servlet-mapping>
<!-- Filter for not to have local cache, instead load from server -->
<filter>
<filter-name>NoCacheFilter</filter-name>
<filter-class>com.jai.NoCacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>NoCacheFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.jai.HttpSessionChecker</listener-class>
</listener>
<!-- Primefaces theme -->
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
</context-param>
<!-- Spring security configuration -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-security.xml</param-value>
</context-param>
<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>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
感谢。但它仍然是相同的,即使我删除/ resources/ – Jay
@Jay添加Spring安全性工作之前呢? – jasilva
是春季安全工作正常。按预期给我提供用户/密码对话框。一旦我修复了CSS样式问题,我会在安全性方面采取进一步措施。 –
Jay