Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10471

ServletContextResourcePatternResolver fails to resolve resources when an app is using a foo#bar.war filename

    XMLWordPrintable

    Details

    • Last commented by a User:
      true

      Description

      The issue can be reproduced with WAR files using the following naming scheme:
      http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming

      The foo#bar.war name is required when you want to achieve a deep context path value like /foo/bar.

      The ServletContextResourcePatternResolver and the UrlResource implementation which is used internally do not provide any handling for special characters like #. This leads to a MalformedURLException.

      The private doRetrieveMatchingJarEntries method of the ServletContextResourcePatternResolver cannot be overridden and the only workaround at the moment is to duplicate the whole class logic in a custom implementation. A simple encoding of the special character fixes the issue.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            rostislav.hristov Rostislav Hristov
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 37 weeks ago