I'm trying to process an incoming request that is a JSON. The code below is a sample:
@Post
@Path("somePath")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response myService(requestDTO requestBody){
//Doing Stuff
}
My DTO class is essentially this:
@JsonInclude(Include.NON_EMPTY)
public class RequestDTO{
private Object object;
public Object getter(){}
public void setter(){}
}
My question is how does the @Consumes annotation know to take the information in the request JSON and place it into the object of my DTO? How would this work if I had multiple variables in my DTO? Or multiple levels in my request body (Object inside Objects, etc)?
Sorry for such a general question, but I'm having a hard time understanding this.
Thanks.