javawso2jax-rsmicroservicesmsf4j

How to create JAX-RS Sub Resources with WSO2 MSf4J


I have create a sample micro service using 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.

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

But i got following result to my REST client.

404 Not Found

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

Please help to resolve this.


Solution

  • This is not supported. MSF4J doesn't claim to be 100% JAXRS compliant, but is a lightweight framework for building microservices. I've created the JIRA [1] for this. We will implement this in future release.

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