如何在Jersey中设置绝对路径映射

时间:2016-04-08 06:35:42

标签: servlets jersey jax-rs

假设我有一个web.xml。

@Path("/")
public class Resource {
    @Path("/resources/{anything}")
    @GET
    public void doAnything(@PathParam("anything") String anything){
    }
}

我的资源类,我已将路径定义为:

class MyBundle extends Bundle
{
   val my_ext = if (SOME_SWITCH) Some(ExtBundle) else None
}

...

io.my_ext match
{
   case Some(b: ExtBundle) =>
      my_ext.a := Bool(false)
      ...
   case _ => require (!SOME_SWITCH)
}

我想配置它,以便用户可以点击网址 http://localhost:8080/myapp/resources/1234

目前用户必须发布 http://localhost:8080/myapp/resources/resources/123

如果无法更改web.xml和Resource类,我可以做任何配置来使其工作吗?

一点历史 我的任务是从Spring 3项目中删除Enunciate 1。现有的web.xml使用“EnunciateJerseyServletContainer”作为servlet。我将其替换为“com.sun.jersey.spi.spring.container.servlet.SpringServlet”,但路径已更改。所以我问,在不修改现有代码的情况下,我可以更改一些配置以使原始端点有效吗?

0 个答案:

没有答案
相关问题