简体   繁体   English

如何使用WSO2 MSf4J创建JAX-RS子资源

[英]How to create JAX-RS Sub Resources with WSO2 MSf4J

I have create a sample micro service using WSO2 MSF4J. 我使用WSO2 MSF4J创建了一个示例微服务。 But i can't access the sub resources (services). 但我无法访问子资源(服务)。 Following are my service classes. 以下是我的服务课程。

Message Resource - 消息资源 -

@Path("/messages")
@Consumes(MediaType.APPLICATION_JSON) 
@Produces(MediaType.APPLICATION_JSON) 
public class MessageResource {

    @Path("/{messageId}/comments")
    public CommentResource getCommentResource(){

        System.out.println("inside the getCommentResource method");
        return new CommentResource();
    }
}

Comment Resource - 评论资源 -

@Path("/") 
public class CommentResource {

    @GET
    @Path("/{commentId}")
    public String test2(@PathParam("messageId") long messageId, @PathParam("commentId") long commentId){

        System.out.println("method to return comment Id : " + commentId + " for message : " + messageId);
        return "method to return comment Id : " + commentId + " for message : " + messageId;
    }
}

I have used following URI to access this service. 我使用以下URI来访问此服务。

GET : http://localhost:8080/messages/1/comments/5 GET: http:// localhost:8080 / messages / 1 / comments / 5

But i got following result to my REST client. 但我得到了以下结果给我的REST客户端。

404 Not Found

Problem accessing: /messages/1/comments/5. Reason: Not Found

Please help to resolve this. 请帮忙解决这个问题。

This is not supported. 这不受支持。 MSF4J doesn't claim to be 100% JAXRS compliant, but is a lightweight framework for building microservices. MSF4J并不声称是100%符合JAXRS,而是一个用于构建微服务的轻量级框架。 I've created the JIRA [1] for this. 我为此创建了JIRA [1]。 We will implement this in future release. 我们将在以后的版本中实现这一点。

[1] - https://wso2.org/jira/browse/WMS-83 [1] - https://wso2.org/jira/browse/WMS-83

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM