Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-212

spaces in path not matched for subresources

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 1.1.RC2
    • 1.0.2.GA
    • jaxrs
    • None

      Matching of subresources does not work if the URI has spaces in the path. The length of the calculated URI is not the same as the encoded path so the matching logic fails.

      ResourceMethodRegistry
      {
      ...
      public ResourceInvoker getResourceInvoker(HttpRequest request, HttpResponse response)

      { List<String> matchedUris = request.getUri().getMatchedURIs(false); if (matchedUris == null || matchedUris.size() == 0) return rootSegment.matchRoot(request); // resource location String currentUri = request.getUri().getMatchedURIs().get(0); return rootSegment.matchRoot(request, currentUri.length()); // currentUri is "http://something.com/With Spaces/Without" }

      ...
      }
      RootSegment
      {
      ...
      public ResourceInvoker matchRoot(HttpRequest request, int start)

      { String path = request.getPreprocessedPath(); // this path is encoded as "http://something.com/With%20Spaces/Without" if (start < path.length() && path.charAt(start) == '/') start++; return matchChildren(request, path, start); // and so matching is done against the string "es" since the preprocessed path is 2 characters longer than the uri. }

      ...}

              patriot1burke@gmail.com Bill Burke (Inactive)
              keithnaas Keith Naas (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: