I have a resource and a sub resource...

@Path(/user)
@Service
public UserServiceImpl {

    @Path("{userId}/contact")
    public IContactService getContactService(@PathParam("userId") Long userId);
}

@Service
public ContactServiceImpl {
    @POST
    public Response addContact(Long userId, Contact contact) {
        .... Bunch of code ....
                try {
                        return Response.status(Response.Status.CREATED)
                                        .location(new URI("" + 
contact.getId())).build();
                } catch (URISyntaxException e) {
                        throw new CreateException(e.getMessage());
                }
    }
}

However, the returned URI is:
http://localhost:8080/myApp/6

while a similar Add user returns
http://localhost:8080/myApp/user/1

It seems that the relative URI does not account for the pathing
implicit in a sub resource call?  Should I use URIInfo to build all my
URI location for sub resources/

Jeff

Reply via email to