Hi

If you prefer then you may want to register a Servlet filter with the
CXFServlet and it will get a chance to handle the ServletException. This
will work only if no ExceptionMappres have been found for a given exception.
At the moment JAXBExceptions produced by a JAXBElementProvider are wrapped
into WebApplicationExceptions which are caught by a default
WebApplicationException ExceptionMapper.
So for this specific case you need to register your custom
WebApplicationException ExceptionMapper which will check the cause of the
exception and if it a JAXB Exception then it will return a customized JAX-RS
Response object.
    
Cheers, Sergey


javamustang wrote:
> 
> Hi Sergey,
> 
> Its working !!!!!!!!!!!!!!!!!!!!!!!!!! :-)
> 
> Thanks a lot for all your patient. 
> 
> Additionally to your last input, i had also to add again
> jaxrs:schemaLocation to make the link from the bean/service to the xsd to
> be used.
> 
> Validation Documentation on http://cwiki.apache.org/CXF20DOC/jax-rs.html
> made me little problems but we solved it. 
> 
> Now i come to a next general question: my service is defined as response
> delivers xml.
> But when validation fales, it delivers f.i.
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Date: Fri, 03 Jul 2009 14:44:26 GMT
> Content-Type: text/plain
> Content-Length: 175
> Connection: close
> 
> JAXBException occurred : cvc-length-valid: Value 'hhhhhhhhhhellj' with
> length = '14' is not facet-valid with respect to length '5' for type
> '#AnonType_testdataserviceRequest'.
> 
> It would be great if f.i a listener or filter in my server could catch
> this error and instead deliver xml (with an error code) back to the
> client. 
> 
> 
> Many thanks for all again MAx
> 
> 
>  
> 

-- 
View this message in context: 
http://www.nabble.com/xsd-Validation-and-CXFNonSpringJaxrsServlet-and-ssl-tp24202869p24334234.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to