@Path Annotation



@Path annotation represents a relative URI that can annotate a class or a method. 
When used on classes, it is referred to as the root resource, providing the root of the resource tree and giving access to subresources.

@Path("/items")
public class ItemService {

@GET
public Items getItems() {
// URI : /items
}

@GET
@Path("/cakes")
public CDs getCakes() {
// URI : /items/cakes
}

@GET
@Path("/pens")
public Pens getPens() {
// URI : /items/pens
}

@POST
@Path("/pencil")
public Response createpencil(Pencil pencil) {
// URI : /items/pencil
}
}

when @Path exists on both the class and method, the relative path to the method is a
concatenation of both.

If @Path("/items") only existed on the class, and not on any methods, the path to access each method would be the same. The only way to differentiate them would be the HTTP verb (GET, PUT, etc.) and the content negotiation (text, XML, etc.)