Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@Path configuration at class level and method level

Tags:

I am using javax.ws.rs.Path class in my REST class to configure path. It is behaving strange ... My configuration is something like this... This is not actual files, but I have shown a replication to make you understand my configurations.

Class1

@Path("/v2")
public class BoxResource {        
   @POST
   @Path("/ie/box")
   public Response createbox(...) {
     ...
   }
}

Class2

@Path("/v2/ie")
public class BagResource {        
    @POST
    @Path("/bag")
    public Response createbag(...) {
        ...
    }        
}

When I make a HTTP request like /v2/ie/box, it throws the Server configuration error. But if I change my Class2 like below , it works fine.

@Path("/v2/ie/bag")
public class BagResource {            
    @POST
    public Response createbag(...) {

    }
}

Why is it like .. Does configuration of @path at class level and method level differs?