I have a Jersey REST api that receives inputs as multipart/form-data. The signature is as follows:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("/getorders")
public Response getOrders(final FormDataMultiPart request) {
The input parameters in the form are:
clientName
orderType
year
I would like instead to have something like this:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("/getOrders")
public Response getOrders(final OrderBean order) {
And get all my inputs in a bean like this:
public class OrderBean {
private String clientName;
private int orderType;
private int year;
// Getters and setters
}
Is there a way to do that automatically with Jersey? I know that I can map the fields manually and fill in the bean, but actually I'm looking for an annotation or something like that, that can fill in the bean automatically.