By "invalid" I mean a parameter that is not expected.
For example:
@Path("/")
public interface ExampleInterface {
@GET
@Path("/example")
public Response test(
@QueryParam("param1") String param1,
@QueryParam("param2") String param2
);
}
And then I call ".../example?param3=foo"
Thanks for the accepted answer. It is very helpful and I also use it. I'm providing a modified version, with the following changes:
-
You can check use a ContainerRequestFilter and compare the passed parameters with the defined parameters:
Don't forget that ServletRequest#getParameterMap returns a Map which contains both - query string parameters and parameters passed in the body of the request. So maybe you need to parse the query string yourself.
Note: This won't speed up your application.