먼저 Google AppEngine 및 Guice를 사용하고 있지만 내 문제는 관련이 없다고 생각됩니다.HTML 페이지를 직접 제공 할 때 서블릿 필터를 어떻게 적용합니까?
사용자가 내 (GWT) webapp에 연결하면 URL은 직접적인 html 페이지입니다. 예를 들어 개발 모드에서는 http://127.0.0.1:8888/Puzzlebazar.html?gwt.codesvr=127.0.0.1:9997
입니다. 지금, 나는 설정 내 web.xml
다음과 같은 방법 :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>PuzzleBazar</display-name>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Puzzlebazar.html</welcome-file>
</welcome-file-list>
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
This Guice listener hijacks all further filters and servlets. Extra
filters and servlets have to be configured in your
ServletModule#configureServlets() by calling
serve(String).with(Class<? extends HttpServlet>) and
filter(String).through(Class<? extends Filter)
-->
<listener>
<listener-class>com.puzzlebazar.server.guice.MyGuiceServletContextListener
</listener-class>
</listener>
</web-app>
그리고 내 appengine-web.xml
입니다 : 내가 Guice를 사용하고 있기 때문에
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>puzzlebazaar</application>
<version>1</version>
<sessions-enabled>true</sessions-enabled>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
, 나는 내가 할 경우, 내 ServletModule에 추가 필터를 구성해야 이 :
filter("*.html").through(SecurityCookieFilter.class);
그러나 내 SecurityCookieFilter.doFilter
은 호출되지 않습니다. 나는 "*.html*"
또는 <url-pattern>*</url-pattern>
과 같은 것을 시도했지만 아무 소용이 없습니다. 어떻게해야합니까?
".html"대신 ".jsp"로 전환하여 작동하는 것으로 나타났습니다. –