我尝试为路径DispatcherServlet
配置弹簧/statefull/wallet/user/login
。
使用Spring-Integration入站HTTP网关映射路径,如下所示:
<int-http:inbound-gateway id="gw"
supported-methods="POST"
request-channel="requestChannel"
reply-channel="replyChannel"
view-name="/login"
path="/statefull/wallet/user/login"
reply-timeout="50000">
</int-http:inbound-gateway>
我的web.xml具有以下应用程序上下文:
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
<!-- Spring application context declaration -->
com.myapp.config.WebAppConfig
</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myapp.root</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
我尝试了以下两个servlet映射:
<servlet>
<servlet-name>spring-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
...
</servlet>
<servlet-mapping>
<servlet-name>spring-servlet</servlet-name>
<url-pattern>/statefull/*</url-pattern>
</servlet-mapping>
但这不起作用。唯一适合我的配置是:
<servlet>
<servlet-name>spring-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
...
</servlet>
<servlet-mapping>
<servlet-name>spring-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
我无法保留第二个配置,因为我想要一些其他的servlet映射,而第二个配置会将所有请求映射到同一个servlet。
任何想法,第一次配置中的错误是什么?