2012-02-27 5 views
2

Google App Engine 플러그인 및 Guice에서 Eclipse IDE를 사용하고 있습니다. 데브 서버에서 실행, 나는 web.xml에서이 두 가지를 해봤과 guice MyServletModule extends ServletModule는 :이상한 자바 서블릿 필터 매핑 동작

<url-pattern>/user/*</url-pattern> 

filter("/user/*").through(LoginFilter.class); 

모두

http://www.domain.com/user/ 

하지만 작동하는 것 .. 둘 다 작동하지 않는 것 같습니다 :

http://www.domain.com/user/myaccount.html 

어떤 아이디어일까요? 문서에 따르면, /user/* 두 가지 모두 작동해야합니다. 맞습니까?

... 나는 iterelf 파일과 관련이 있다고 생각하는데, 나는 "*.html" 중 하나를 필터링 할 수 없다.

편집 : 해결. 한숨 ... 나는 GAE/J의 문서에서이 재미있는 이야기를 발견 "Note: Filters are not invoked on static assets, even if the path matches a filter-mapping pattern. Static files are served directly to the browser."

답변

2

나는 GAE/J 워드 프로세서에서이 재미있는 이야기를 발견 : 모든 자바 서블릿의 문서가 당신이 할 수 있다고하더라도

Note: Filters are not invoked on static assets, even if the path matches a filter-mapping pattern. Static files are served directly to the browser. 

그것, 당신은 GAE/J에서 그것을 할 수 없습니다.

1

나는이 패턴이 작동하는 것을 발견 :

<security-constraint> 
    <web-resource-collection> 
     <url-pattern>/myFile.html</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>*</role-name> 
    </auth-constraint> 
</security-constraint> 

.. 당신이 파일 아마이 필터링됩니다를 지정하는 경우, 그래서!

+0

감사합니다. 물론 네이티브 GAE 제약 조건은 잘 작동하지만, 필터에서 수행하는 저장된 세션 데이터에 대한 사용자 정의 검사가 추가로 필요했습니다. 제약 조건이 제공하지 않았습니다. 나는 단순히 정적 * .html을 * .jsp로 바꾼다. – DougA