Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3422

'Cannot find target method' when certain hex-encoded characters are used in @PathParam in GET requests

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.1, 2.3.3
    • 2.4, 2.3.4
    • JAX-RS
    • None
    • Tomcat 6

    Description

      I have following simple JAX-RS service:

      public interface RootService {
          @Path("data1")
          public DataService getDataService();
      }
      
      public interface DataService {
          @GET
          @Path("data2/{id}")
          public Data getData(@PathParam("id") String id);
      }
      

      All works correctly as long as URL contains in position of @PathParam("id") ASCII characters and digits or hex-encoded spaces. These URLs work:

      GET /root/data1/data2/1
      GET /root/data1/data2/AAA2BBB
      GET /root/data1/data2/1%202

      However, when URL on position of the parameter

      {id}

      contains certain hex-encoded characters other than space (%20), like in this URL (this example contains digit '1' followed by 'latin capital letter d with caron'):

      GET /root/data1/data2/1%C4%8E

      I'll get following exception:

      javax.ws.rs.WebApplicationException
      	at org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:399)
      	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:204)
      	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
      	at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
      	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
      	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
      	at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      	at java.lang.Thread.run(Thread.java:662)
      
      //////////////////////////////
      // Simple implementations - just to complete the example...
      
      public class RootServiceImpl implements RootService {
          @Override
          public DataService getDataService() {
              return new DataServiceImpl();
          }
      }
      
      public class DataServiceImpl implements DataService {
          @Override
          public Data getData(final String id) {
            // ...
          }
      }
      

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            karel.vlcek Karel Vlcek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: