2
我全部,春季靜態HTML文件問題3
我有一個彈簧應用程序使用基於角色的安全性。應用程序工作正常,它只是我需要引入一些靜態HTML頁面,這些頁面也將在同一場戰爭中進行託管。所以如果www.myapp.com/abc/work.jsp是我的安全頁面,那麼www.myapp.com/home.htm應該顯示靜態html頁面。我已經合併HTML文件,但問題是我在www.myapp.com/home.htm上獲得404,www.myapp.com/abc/work.jsp正常工作。
web.xml中 -
<display-name>guru</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/app-security-config.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>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/home.htm</welcome-file>
</welcome-file-list>
我的應用程序的安全性-config.xml中
<http auto-config="false" disable-url-rewriting="false" access-decision-manager-ref="accessDecisionManager"
entry-point-ref="authenticationProcessingFilterEntryPoint">
<custom-filter position="FORM_LOGIN_FILTER" ref="authenticationProcessingFilter" />
<custom-filter position="LOGOUT_FILTER" ref="customLogoutFilter"/>
<access-denied-handler error-page="/login.jsp?login_error=true"/>
<intercept-url pattern="/login.htm" filters="none" />
<intercept-url pattern="/abc/def/**" access="ROLE_USER"/>
<intercept-url pattern="/**" access="ROLE_ANONYMOUS" />
<anonymous enabled='true'/>
<session-management session-authentication-strategy-ref="sas"/>
<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
</http>
此鏈接可能會幫助您http://stackoverflow.com/questions/1234298/can-springmvc-be-configured-process-all-requests-but-exclude-static-content – raddykrish 2012-03-20 04:50:40
是「abc」應用程序中的上下文根目錄還是目錄? – nickdos 2012-03-20 05:35:26
abc是上下文根,這是生產代碼,所以我已經掩蓋了它:) – Sachin 2012-03-20 05:36:30