Re: JAX-RS and @ValidateOnExecution

Pavel Bucek

Hi Christian,

seems to be a Jersey bug.


On 19/06/2017 20:39, Christian Kaltepoth wrote:
Hey everyone,

I've a question regarding JAX-RS and @ValidateOnExecution. Please have a look at the following code:

  @ValidateOnExecution(type = ExecutableType.NONE)
  public String method( @QueryParam("q") @NotNull String query ) {
    return "Resource method was invoked!";

What is the expected outcome for a request which doesn't contain any query parameter and therefore violates the @NotNull constraint?

From my understanding the use of @ValidateOnExecution disables validation and therefore the resource method must be called even if there is no query parameter in the request URL. That's how RESTEasy handles this case.

But Jersey seems to completely ignore the @ValidateOnExecution annotation in this example. Therefore Jersey validates the query parameter and returns "400 Bad Request" without invoking the resource method.

Any thoughts on this?



Join to automatically receive all group messages.