这个奇怪的泽西警告意味着什么?

时间:2010-12-02 09:31:33

标签: java jersey

这个警告在泽西岛1.4中意味着什么:

WARNING: A sub-resource method, public final java.lang.String com.XXX.render(), 
with URI template, "/", is treated as a resource method

这是该方法的外观:

@GET
@Produces(MediaType.APPLICATION_XML)
@Path("/")
public final String render() {
  return "test";
}

2 个答案:

答案 0 :(得分:42)

为什么需要为方法指定这样的路径? @Get足以告诉球衣它是整个类的默认方法(我假设你的类有一些@Path(“/ MyRes”)注释)。

答案 1 :(得分:0)

看起来你上周与How to route JAX-RS request conditionally, depending on the suffix?有同样的问题 - 运气好吗?

在网上浏览一下,发现您可能错误地设置了构造函数 - 请仔细阅读http://jersey.576304.n2.nabble.com/Problem-using-the-JerseyTest-class-td3256608.html - 遇到类似问题且能够解决问题的人。