我正在使用Jersey v1.x和Guice Servlet。我想要做的是绑定一个匹配any @Path
的 Jersey Resource ,这样我就可以使用 Jersey 来响应 404。
我正在寻找这样做,因为我的 servlet 由不同的组件组成(例如,/api
位于/
.ServletModule
小服务程序:
- 在我的
ApiServletModule
:serve("/api").with(GuiceContainer.class, conf)
- 在我的
WebUiServletModule
:serve("/").with(GuiceContainer.class, conf)
/api
在此设置中,我想从每个负责的子项目的代码库中为 webapp (或)的每个部分定义 404 响应主体的外观/
,而无需重新实现 Jersey
到目前为止,我已尝试绑定匹配@Path("/")
,@Path("*")
和的资源@Path("/*")
,但是当我请求时,这些资源似乎都没有被拾取/some/path/that/doesnt/exist