JavaEE 응용 프로그램에서.
내가 web.xml 파일에 "환영 파일"로 index.html 페이지가index.html에 대한 응답에 HTTP 헤더 추가
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
내가 index.html을 대한 응답으로 HTTP를 헤더를 추가 할 수는
한 가지 방법은 사용 index.jsp를하다 index.html 대신에 scriptlet을 추가하십시오.
<% response.addHeader("X-Frame-Options", "DENY"); %>
다른 방법이 있습니까? 내가 index.jsp를 대신 index.html을의 사용하지 않기 때문에
WelcomeFileFilter {
void filter(HttpServletResponse response) {
response.addHeader("X-Frame-Options", "DENY");
}
}
: 는 possiblility 같은 예를 들어 뭔가를 들어 필터
의 어떤 종류가 추가하는 것입니다.
welcome-file이 index.html 인 경우 불행하게도 필터가 적용되지 않는 것으로 보입니다. 환영 파일이 index.jsp 인 경우에만 적용됩니다 :-( –
죄송 필터가 잘 작동합니다. "/ *"매핑이 잘못되었습니다. "*"로 변경 했으므로 이제는 문제가 없습니다. –
responseheaderfilter는 오래되었지만 유지 관리되지 않았습니다. 더 이상 (2009 년 6 월의 마지막 코드는 evol) 다음과 같은 심각한 버그가 있습니다. http://code.google.com/p/responseheaderfilter/issues/detail?id=2 왜 lib를 사용하고 싶습니까? 표준 JavaEE가 모든 요구 사항을 충족합니까? –