问题
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