Я пытаюсь прочитать параметр корневого пути ресурса в файле вспомогательных ресурсов, но я получаю сообщение об ошибке. Пожалуйста помогите.REST JAX RS: Jersey: Как читать pathparam корневого ресурса в дополнительном ресурсе?
Путь, я следующее:
Root Service ресурс:
@Path("/{messageId}/comments")
public CommentResource getCommentResources(){
return new CommentResource();
}
дополнительный код ресурса:
@Path("/")
public class CommentResource {
private CommentDAOImpl commentDaoObject = new CommentDAOImpl();
@GET
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<Comment> getAllCommentsForAMessage(@PathParam("messageId") long messageId){
return commentDaoObject.getAllCommentsForMessage(messageId);
}
@Path("/{commentId}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Comment getCommentForAMessage(@PathParam("commentId") long commentId, @PathParam("messageId") long messageId){
return commentDaoObject.getCommentForMessage(messageId, commentId);
}
}
При чтении "MESSAGEID" путь из параметров в подэкранном ресурса я являюсь получение ошибки:
Error: @PathParam value 'messageId' does not match any @Path annotation template parameters of the java method 'getCommentForAMessage' and its enclosing java type 'org.ramesh.jrs.Messenger.resources.CommentResource'.
Может ли кто-нибудь помочь мне решить проблему?