Reputation: 1703
@Path("report/v1")
public class ReportService {
@Path("report")
@GET
@Produces("application/json")
public ReportResponse report(@NotNull @QueryParam("startDate") String startDate,
@NotNull @QueryParam("endDate") String endDate,
@NotNull(message = "{param.invalid.periodType}") @QueryParam("periodType") String periodType) {
PublisherResponse res = new PublisherResponse();
I called method like below..
http://localhost:8080/report/v1/report?startDate=20140101&endDate=20140505
I expected validation error because periodType is missing. but returned 404.
How can i fix?
Upvotes: 0
Views: 749
Reputation: 209052
I'm going to make some assumptions.
The default behavior for the validation feature is to send a 400 Bad Request (that doesn't get mapped to a response). If we want Jersey to send it's validation error responses, we need to set the following property to true
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
See more at Configuring Bean Validation Support
Upvotes: 1