On Apr 10, 2009, at 6:25 PM, Tatu Saloranta wrote:
> Quick question: I am planning to use hibernate-validation (impl of
> JSR-303) with my Jersey service, and it looks like a very good match
> if things work as planned. I can do this easily from my resources, and
> that's good enough for immediate use.
>
> But it also seems like aspect that could be quite easily added to
> generic handling: for example, if bound input argument fails
> validation, a 4xx error could be returned.
>
> So I was wondering if:
>
> (a) There is already a natural place for hooking this in (by adding
> a filter?)
It seems like the right approach is to utilize a method-level
interceptor because that is when the method parameter values will be
available to be validated e.g. with some AOP.
The resource-level filters of Jersey do not currently have available
the method parameter values. The reason being is that a filter could
modify some of the HTTP request before the method parameter values are
extracted from the request.
>
> (b) If not, is this something for which a simple hook could be added.
> Probably not JSR-303 specific.
>
How is 303 validation performed?
The 311 EG did look at 303 but concluded that there was nothing
specific required w.r.t to integration of the two specs.
Paul.