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

spaces in path not matched for subresources

    XMLWordPrintable

Details

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

    Description

      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. }

      ...}

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: