0

I am trying to validate a json request from client using bean validation. Here is my resource class

@Path("/test")
public class Tester {

public Tester(){

}

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_HTML)
public Response test(@Valid Test test) throws ConstraintViolationException{

    return Response.status(200).entity("hello world")
 }

}

and here is my Test class

public class Test {

public Test(){

}

@NotNull(message="test cannot be empty")
private String test;

public String getTest() {
    return test;
}

public void setTest(String test) {
    this.test = test;
}
}

and everytime i send a request from client it responds 415 unsupported media type can anybody please help? i used jersey-bean-validation-2.25.1 Thanx!!!

djdere
  • 321
  • 2
  • 10

0 Answers0