我的RestEasy项目中需要有多个前缀。同样,我在web.xml
中定义了多个servlet。
<servlet>
<servlet-name>resteasy-servlet1</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest1</param-value>
</init-param>
<init-param>
<param-name>resteasy.resources</param-name>
<param-value>com.test.rs.TokenGenerator</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>resteasy-servlet2</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest2</param-value>
</init-param>
<init-param>
<param-name>resteasy.resources</param-name>
<param-value>com.test.rs.ResourceProvider</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet1</servlet-name>
<url-pattern>/rest1/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>resteasy-servlet2</servlet-name>
<url-pattern>/rest2/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>AuthFilter</filter-name>
<filter-class>com.test.rs.filter.AuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthFilter</filter-name>
<url-pattern>/rest2/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
此stackoverflow post中定义了相同的方法,但是
我尚未在我的项目中使用它。尝试访问下面的网址时,我总是会遇到404 Not Found
错误。谁能突出显示我在配置中缺少的内容?
部署的项目的Web上下文根为rstest
我的班级的@Path
注释定义如下
@Path("/token")
public class TokenGenerator {