0

我正在使用 Spring 和 Jetty。到目前为止,我还没有使用过 JSP,但我有一个使用它们的 3rd 方 servlet。

它显示在 Jetty 试图加载“jsp”servlet 的日志中。但我希望所有请求都通过 springs 调度程序 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>

非 JSP 请求的 Jetty 日志:

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

JSP 请求的 Jetty 日志:

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
4

1 回答 1

1

添加一个<servlet-mapping>*.jsp</servlet-mapping>以将此扩展映射到您的调度程序 servlet。

于 2011-03-22T12:00:38.447 回答