我正在使用Spring with Jetty。到目前为止,我还没有使用过JSP,但我有一个使用它们的第三方servlet。
Jetty正在尝试加载“jsp”servlet。但我希望所有请求都能通过spring dispatcher servlet。
如何阻止Jetty拦截* .jsp?
的web.xml
<web-app xmlns:...
<!-- ~~~~~~~~~~~~~~~ SPRING DISPATCHER SERVLET ~~~~~~~~~~~~~~~ -->
<!-- Allows Spring to handle all web requests -->
<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>
<!-- ~~~~~~~~~~~~~~~ SPRING SECURITY HOOK ~~~~~~~~~~~~~~~ -->
<!-- removed for clarity -->
<!-- ~~~~~~~~~~~~~~~ BEAN SCOPES FOR WEB ~~~~~~~~~~~~~~~ -->
<!-- removed for clarity -->
</web-app>
Jetty记录非JSP请求:
28902 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - REQUEST /myaccount/transactions on org.eclipse.jetty.server.nio.SelectChannelConnector$3@52d85409
28902 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - Got Session ID 1x85qr20xozki139cfcd6a520o from cookie
28902 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - sessionManager=org.eclipse.jetty.server.session.HashSessionManager@21e3cc77
28902 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - session=org.eclipse.jetty.server.session.HashSessionManager$HashedSession:1x85qr20xozki139cfcd6a520o@1420624050
28902 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - servlet=dispatcher
28903 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - servlet holder=
28903 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - chain=
28903 [qtp1620636050-15 - /myaccount/transactions] DEBUG org.eclipse.jetty.util.log - call filter springSecurityFilterChain
Jetty记录JSP请求:
398317 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - REQUEST /console/login.jsp on org.eclipse.jetty.server.nio.SelectChannelConnector$3@1eaf0e38
398317 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - Got Session ID 1x85qr20xozki139cfcd6a520o from cookie
398317 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - sessionManager=org.eclipse.jetty.server.session.HashSessionManager@21e3cc77
398318 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - session=org.eclipse.jetty.server.session.HashSessionManager$HashedSession:1x85qr20xozki139cfcd6a520o@1420624050
398318 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - servlet=jsp
398319 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - servlet holder=
398319 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - chain=
398319 [qtp1620636050-14 - /console/login.jsp] DEBUG org.eclipse.jetty.util.log - call filter springSecurityFilterChain
答案 0 :(得分:1)
添加<servlet-mapping>*.jsp</servlet-mapping>
以将此扩展名映射到您的调度程序servlet。