Hi
On 25/02/14 17:51, Charlie Read wrote:
In browsing issue #5401,
https://issues.apache.org/jira/browse/CXF-5401
it appears as of Nov, 2014, work was still being done on exceptions
triggered by violations of validation constraints (ie, handling
ConstraintViolationException).
Here are my questions:
* Does the current violation-handler propagate up the "message" encoded in
the
constraint annotation? IE, does the message reach the consumer of the API?
For example, if I have:
@Get
...
public Object getSomething()(@QueryParam("color") @NotNull(message =
"color should be specified") String color) {
...
}
will the message "color should be specified" be included in the response
body?
No, it will be logged only
* If there is a constraint violation (Eg, in above example, if
color-parameter is null), where is the
ConstraintViolationException handled? Where can it be intercepted and
custom-processed?
I provisioned a ValidationExceptionMapper (using the CXF 3.0-milestone1
release), but when
I triggered a ConstraintViolationException, the toResponse() method could
not detect it.
How did you register it ?
* I also noticed in issue #5401 that the logic for returned exceptions is
in flux.
Can someone clarify where the logic stands, and specifically what we should
expect in terms of support for message-propagation back to API consumers
(in the event of ConstraintViolationExceptions)?
I think it is all done as recommended by the JAX-RS 2.0 spec; however
please try 3.0.0-milestone2 - there might've been some minor changes
Cheers, Sergey
Thanks,
Charlie
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com