What does this strange Jersey warning mean?

时间秒杀一切 提交于 2019-12-06 16:36:31

问题


What does this warning mean in 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

This is how the method looks:

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

回答1:


Why do you need specify such path for method? @Get is enough to tell jersey that it is default method for entire class (I'm assuming that your class has some @Path("/MyRes") annotation).




回答2:


Looks like you had the same problem last week with How to route JAX-RS request conditionally, depending on the suffix? - any luck fixing it there?

A look around on the net reveals you may have set-up your constructor incorrectly - have a read through http://jersey.576304.n2.nabble.com/Problem-using-the-JerseyTest-class-td3256608.html - someone who had a similar problem and was able to resolve it.



来源:https://stackoverflow.com/questions/4333463/what-does-this-strange-jersey-warning-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!