我正在尝试将Jetty Servlet与具有可变URI的POST请求进行映射。
我正在指定带有前缀和通配符的URI。 web.xml看起来像这样
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>my service
</display-name>
<welcome-file-list>
<welcome-file>myApplication/index.html</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<servlet>
<servlet-name>my-service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.my.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>my-service</servlet-name>
<url-pattern>/processFullDictionary/*</url-pattern>
</servlet-mapping>
</web-app>
通过用显式URI替换通配符,可以正确映射servlet,并且不会显示错误:
<servlet-mapping>
<servlet-name>my-service</servlet-name>
<url-pattern>/processFullDictionary/form/sense/etym/re/xr/subEntry/note</url-pattern>
</servlet-mapping>
我正在使用Jetty 9.4.11.v20180605作为服务器。知道可能是什么问题吗?