cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: How to intercept exceptions thrown by CXF servlet
Date Sun, 23 Jun 2013 17:33:04 GMT
Hi
On 23/06/13 10:38, Andrei Shakirin wrote:
> Hi,
>
> Looks as defect for me. I will expect 400 Bad Request from CXF servlet in this case.
> Sergei, WDYT?
>
I think the reason for this particular exception is that the underlying 
container decodes request URI unexpectedly, there was a Windows specific 
issue to do with decoding %20, see
http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-Tomcat,

but it could be caused by some other container specific issue.

One can always add a filter can catch exceptions from there, but that 
would probably hide the container issue

Cheers, Sergey



> Regards,
> Andrei.
>
>> -----Original Message-----
>> From: Mandy Warren [mailto:mandys.inbox@gmail.com]
>> Sent: Samstag, 22. Juni 2013 17:01
>> To: users@cxf.apache.org
>> Subject: How to intercept exceptions thrown by CXF servlet
>>
>>
>> I have developed a REST service using Apache CXF and notice that if I send
>> invalid characters in the URL, the CXF servlet throws back the following
>> exception before it gets to my code:
>>
>> Servlet failed with Exception java.lang.IllegalArgumentException at
>> java.net.URI.create(URI.java:841) at
>> org.apache.cxf.transport.servlet.BaseUrlHelper.getBaseURL(BaseUrlHelper.j
>> ava:49) at
>> org.apache.cxf.transport.servlet.ServletController.getBaseURL(ServletContr
>> oller.java:73) at
>> org.apache.cxf.transport.servlet.ServletController.updateDestination(Servle
>> tController.java:82) at
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.j
>> ava:162) at
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.j
>> ava:137) at
>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpring
>> Servlet.java:158) at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstra
>> ctHTTPServlet.java:239) at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPS
>> ervlet.java:164) at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPS
>> ervlet.java:215)
>> This results in a 500 status code being returned to the client.
>>
>> I would ideally like to intercept this exception and return a 400 Bad Request
>> status code to the client but I am unable to work out how to do this.
>>
>> Any help much appreciated!
>>
>> Many thanks
>>
>


Mime
View raw message