eclipse - JAX-RS sub resource @PathParam value does not match any @Path annotation template parameters of the java method and its enclosing java type -
i have class sub resource , when ran, works no errors except eclipse show red underline, how can make eclipse "know" parent @path part of it.
ex.
in messageresouce
@path("/{messageid}/comments") public commentresource getcommentresource() { return new commentresource(); }
and in commentresource
@path("/") // optional subresources @produces(mediatype.application_xml) @consumes(mediatype.application_xml) public class commentresource { private commentservice commentservice = new commentservice(); @get public list<comment> getallcomments(@pathparam("messageid") long messageid) { return commentservice.getallcomments(messageid); } @post public comment addmessage(@pathparam("messageid") long messageid, comment comment) { return commentservice.addcomment(messageid, comment); } @put @path("/{commentid}") public comment updatemessage(@pathparam("messageid") long messageid, @pathparam("commentid") long commentid, comment comment) { comment.setid(commentid); return commentservice.updatecomment(messageid, comment); } @get @path("/{commentid}") public string test2(@pathparam("messageid") long messageid, @pathparam("commentid") long commentid) { // messageid still gets // passed parent // resource return "method return commment id: " + commentid + " , messageid: " + messageid; } @delete @path("/{commentid}") public void deletecomment(@pathparam("messageid") long messageid, @pathparam("commentid") long commentid) { commentservice.removecomment(messageid, commentid); } }
all messageid path parameters underlined red error runs fine, it's annoying see there , don't want might @ code freak out.
thanks
i had same problem resolved going preferences -> jax-rs -> jax-rs validator -> jax-rs resource methods , check unbound @pathparam annotation value warning or ignore (default error). in case of ignore no longer see message. i've read there might has jax-rs validation. i'm using jax-rs 1.1 jersey 1.19 (not sure if in jax-rs 2.0 have same behavior).
Comments
Post a Comment