'서블릿'에 해당되는 글 1건

  1. 2009/04/11 Servlet specification 2.4에서 JSP 속성 그룹에 유효한 URL 패턴
Computing/Programming2009/04/11 13:23
JSP를 공부하던 중, 웹 애플리케이션의 web.xml 파일 내 필터 매핑 엘리먼트의 속성 중 하나인 <url-pattern> 엘리먼트 설정을 책의 내용대로 'some_path/*.jsp'처럼 해서 특정 디렉터리('some_path')에 있는 JSP 파일에만 필터를 적용되도록 했더니 톰캣이 뜨면서 오류가 발생한다. 이클립스 콘솔에 출력된 에러 메시지를 보니 'invalid <url-pattern>'이란다.

구글을 찾아보니, Servlet specification 2.4에서 JSP 속성 그룹(jsp-propertity-group)에 허용되는 URL 패턴은 다음과 같단다.

- A string beginning with a / character and ending with a /* suffix is used for path mapping.
- A string beginning with a *. prefix is used as an extension mapping.
- A string containing only the / character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
- All other strings are used for exact matches only.

즉, 위와 같이 하려면 '/some_path/*'라고 해야한다.

구글에서 찾은 페이지에 따르면, 톰캣의 이전 버전에서는 'some_path/*.jsp' 같은 것이 가능했다고 한다. 그러나 이것은 Servlet specification을 따르는 것이 아니므로, 수정되었다고 한다.

* 참고 문헌
- http://objectmix.com/java/159394-tomcat-5-0-web-xml-filter-mapping-url-pattern-content-jsp.html
- http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg43676.html
- http://www.coderanch.com/t/84442/Tomcat/write-correct-url-pattern-security
Posted by pcandme

TRACKBACK http://pcandme.net/trackback/58 관련글 쓰기

댓글을 달아 주세요