[jboss-jira] [JBoss JIRA] (AS7-6249) ServletContext.getResource() doesn't work correctly for files containing hash characters

Christian Kaltepoth (JIRA) jira-events at lists.jboss.org
Mon Dec 24 09:53:08 EST 2012


Christian Kaltepoth created AS7-6249:
----------------------------------------

             Summary: ServletContext.getResource() doesn't work correctly for files containing hash characters
                 Key: AS7-6249
                 URL: https://issues.jboss.org/browse/AS7-6249
             Project: Application Server 7
          Issue Type: Bug
          Components: Web
    Affects Versions: 7.1.3.Final (EAP)
         Environment: Linux 3.2.0-30-generic Ubuntu SMP x86_64 GNU/Linux
            Reporter: Christian Kaltepoth
            Assignee: Remy Maucherat
         Attachments: as7-url-bug.zip

{{ServletContext.getResource()}} returns an invalid URL if the file name contains {{#}} characters.

Example:

{code:java}
URL url = servletContext.getResource("/file#1.txt");
{code}

The resulting URL object will be spitted at the {{#}} character like this:

{code}
url.toString():   jndi:/default-host/tomcat-url-bug/file#1.txt
url.getPath():    /default-host/tomcat-url-bug/file
url.getRef():     1.txt
{code}

Calling {{url.openStream()}} will throw a {{FileNotFoundException}}.

This is a known Tomcat issue fixed in 7.0.28.

References:

https://issues.apache.org/bugzilla/show_bug.cgi?id=53257
https://issues.apache.org/bugzilla/show_bug.cgi?id=51584

According to the discussion on the Tomcat issue tracker, there are also problems for other characters which have special meaning in URLs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list