users@jersey.java.net

[Jersey] Re: validating query param inputs

From: Michal Gajdos <michal.gajdos_at_oracle.com>
Date: Mon, 20 Jan 2014 22:46:29 +0100

If you're using GF 4.0 you have bean validation in Jersey
out-of-the-box. If you're using something else (Jetty, Tomcat, ...) you
need to add jersey-bean-validation module to your dependencies.

You can find more information in our User Guide, Bean Validation Support
section - https://jersey.java.net/documentation/latest/bean-validation.html

Michal

On 20.01.2014, 22:33 , phil swenson wrote:
> here is an example service I wrote:
>
> @GET
> @Path("/ProcessMetricData")
> @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML})
> public ProcessMetricData
> getProcessMetricData(@QueryParam("processModelId") String modelId,
> @QueryParam("startTime") long startTime, @QueryParam("endTime") long
> endTime, @NotNull @QueryParam("statsInterval") long statsInterval) {
>
> I want to validate that each query param is set by the client….
>
> Best I can tell there is no built in validation support in jersey
> (using 2.0)… can someone confirm?
>
> thanks,
> phil