cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mandy Warren <>
Subject How to intercept exceptions thrown by CXF servlet
Date Sat, 22 Jun 2013 15:00:34 GMT

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( at org.apache.cxf.transport.servlet.ServletController.getBaseURL(
at org.apache.cxf.transport.servlet.ServletController.updateDestination(
at org.apache.cxf.transport.servlet.ServletController.invoke( at
org.apache.cxf.transport.servlet.ServletController.invoke( at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(
at javax.servlet.http.HttpServlet.service( at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(
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

  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message