[jboss-jira] [JBoss JIRA] (WFLY-1457) ServletContext getResourcePaths are not returning relative paths

Stuart Douglas (JIRA) jira-events at lists.jboss.org
Wed Jun 12 19:06:54 EDT 2013


     [ https://issues.jboss.org/browse/WFLY-1457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart Douglas resolved WFLY-1457.
----------------------------------

    Fix Version/s: 8.0.0.Alpha2
       Resolution: Done

    
> ServletContext getResourcePaths are not returning relative paths
> ----------------------------------------------------------------
>
>                 Key: WFLY-1457
>                 URL: https://issues.jboss.org/browse/WFLY-1457
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 8.0.0.Alpha1
>            Reporter: Marek Schmidt
>            Assignee: Stuart Douglas
>             Fix For: 8.0.0.Alpha2
>
>         Attachments: jboss-as-helloworld.war
>
>
> ServletContext getResourcePaths should return "relative paths", according to 
> http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getResourcePaths%28java.lang.String%29
> the result of which the returned paths won't work if passed to ServletContext getResource method, which expects relative paths and will return null URLs
> Having a simple servlet
> {code}
> Set<String> paths = req.getServletContext().getResourcePaths("/WEB-INF/classes");
>     	
>         resp.setContentType("text/plain");
>         PrintWriter writer = resp.getWriter();
>         
>         for (String path : paths) {
>         	writer.println(path + " , url: " + req.getServletContext().getResource(path));
>         }
>         
>         writer.close();
> {code}
> will result in
> {noformat}
> /home/maschmid/testing/wildfly-8.0.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/temp9578b420b6a0dfd8/content-b6b9429f41b85866/WEB-INF/classes/hello.resource , url: null
> /home/maschmid/testing/wildfly-8.0.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/temp9578b420b6a0dfd8/content-b6b9429f41b85866/WEB-INF/classes/my.properties , url: null
> /home/maschmid/testing/wildfly-8.0.0.Alpha2-SNAPSHOT/standalone/tmp/vfs/temp9578b420b6a0dfd8/content-b6b9429f41b85866/WEB-INF/classes/org , url: null
> {noformat}
> while the expected output would be, e.g. the following result of EAP 6.1:
> {noformat}
> /WEB-INF/classes/hello.resource , url: jndi:/default-host/jboss-as-helloworld/WEB-INF/classes/hello.resource
> /WEB-INF/classes/org/ , url: jndi:/default-host/jboss-as-helloworld/WEB-INF/classes/org/
> /WEB-INF/classes/my.properties , url: jndi:/default-host/jboss-as-helloworld/WEB-INF/classes/my.properties
> {noformat}

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