cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mandy Warren <>
Subject Re: How to intercept exceptions thrown by CXF servlet
Date Sun, 23 Jun 2013 19:50:55 GMT
Thanks very much for taking the time to reply..

Ok so I am running on a weblogic 10.3 container and it does seem that the problem occurs when
deploying to this environment but not when running on Tomcat 7. On Tomcat I do get a 400 status
code returned.

The 2 dodgy chars I am using in my url are \" 

Even reading the link below I still don't really understand quite what might be happening,
would you mind explaining in a bit more detail so I can search for a possible fix in the weblogic

Also, assuming weblogic has an issue, please could you explain how I write a filter to trap
the exception and convert the response code manually? I have tried writing an Interceptor
but the handleMessage method is never called (perhaps I specified the phase incorrectly -

Many thanks


On 23 Jun 2013, at 18:33, Sergey Beryozkin <> wrote:

> 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
> 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 []
>>> Sent: Samstag, 22. Juni 2013 17:01
>>> To:
>>> 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
>>> at
>>> org.apache.cxf.transport.servlet.BaseUrlHelper.getBaseURL(BaseUrlHelper.j
>>> ava:49) at
>>> org.apache.cxf.transport.servlet.ServletController.getBaseURL(ServletContr
>>> at
>>> org.apache.cxf.transport.servlet.ServletController.updateDestination(Servle
>>> 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
>>> at
>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(Abstra
>>> at
>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPS
>>> at
>>> javax.servlet.http.HttpServlet.service( at
>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPS
>>> 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

View raw message