title: Handling REST Exception
body: <p>I'm using a REST service with CXF that does a GET request with an int parameter.</p>
  
  <pre><code>@Path("parkingservice")
  public interface ParkingService {
  
      /**
       * @param id
       * @return
       */
  
     @GET
     @Path("/parkings/{id}/parkingState")
     @Produces(MediaType.APPLICATION_JSON)
     ParkingState getStatus(@PathParam("id") int id);
  }
  </code></pre>
  
  <p>I call my service this way :
  <a href="http://domain.com:8087/services/rest/parkingservice/parkings/2805/parkingState" rel="nofollow">http://domain.com:8087/services/rest/parkingservice/parkings/2805/parkingState</a></p>
  
  <p>When I put a number, it works, but when I put a String, I have this exception : </p>
  
  <pre><code>WARNING: javax.ws.rs.NotFoundException: java.lang.NumberFormatException: For input string: "dd"
      at org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:322)
      at org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:845)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromUriParam(JAXRSUtils.java:1041)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:733)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:708)
      at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:655)
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:238)
      at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:99)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: java.lang.NumberFormatException: For input string: "dd"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
      at java.lang.Integer.parseInt(Integer.java:449)
      at java.lang.Integer.valueOf(Integer.java:554)
      at org.apache.cxf.common.util.PrimitiveUtils.read(PrimitiveUtils.java:60)
      at org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:310)
      ... 34 more
  </code></pre>
  
  <p>I'd like to avoid having this exception no matter what type I give..or to find a way to handle this exception with a message like "please provide a good Id"</p>
  
  <p>Thanks a lot</p>