[jboss-jira] [JBoss JIRA] (WFLY-807) ServletContext#getRealPath() returns wrong path
Filipe Ferraz (JIRA)
jira-events at lists.jboss.org
Mon Jul 22 23:25:26 EDT 2013
[ https://issues.jboss.org/browse/WFLY-807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791558#comment-12791558 ]
Filipe Ferraz edited comment on WFLY-807 at 7/22/13 11:24 PM:
--------------------------------------------------------------
I tried to reproduce this bug in my system (MacOSX Lion and Wildfly 8.0.0.Alpha4-SNAPSHOT) creating a test servlet that responds to 'app-context/test', a file.txt at webapp dir and inside the servlet#doGet() get the servletContext and run the following commands:
1. servletContext.getRealPath("") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servlet-test.war-10e40a3c8a480cb5/
2. servletContext.getRealPath("/test") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servet-test.war-10e40a3c8a480cb5/test
3. servletContext.getRealPath("/file.txt") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servet-test.war-10e40a3c8a480cb5/file.txt
4. servletContext.getRealPath("/test/file.txt") : null
Seems to be the correct and expected response, the line 4 will return a non null value just if inside the webapp the file is inside a test folder.
If possible try to explain more the problem to be possible reproduce the bug (for me seems to not be a bug, it's and expected behavior).
was (Author: filipeferraz):
I have tried to reproduce this bug in my system (MacOSX Lion and Wildfly 8.0.0.Alpha4-SNAPSHOT) creating a test servlet that responds to 'app-context/test', a file.txt at webapp dir and inside the servlet#doGet() get the servletContext and run the following commands:
1. servletContext.getRealPath("") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servlet-test.war-10e40a3c8a480cb5/
2. servletContext.getRealPath("/test") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servet-test.war-10e40a3c8a480cb5/test
3. servletContext.getRealPath("/file.txt") : {...}/wildfly-8.0.0.Alpha4-SNAPSHOT/standalone/tmp/vfs/temp75c7aa7a10b66a9e/servet-test.war-10e40a3c8a480cb5/file.txt
4. servletContext.getRealPath("/test/file.txt") : null
Seems to be the correct and expected response, the line 4 will return a non null value just if inside the webapp the file is inside a test folder.
If possible try to explain more the problem to be possible reproduce the bug (for me seems to not be a bug, it's and expected behavior).
> ServletContext#getRealPath() returns wrong path
> -----------------------------------------------
>
> Key: WFLY-807
> URL: https://issues.jboss.org/browse/WFLY-807
> Project: WildFly
> Issue Type: Bug
> Environment: MacOSX Lion
> Reporter: Douglas Campos
>
> GET /aerogear-controller-demo/test.haml
> ServletContext.getRealPath("/aerogear-controller-demo/test.haml") returns:
> /Users/qmx/dev/jboss-as-7.1.1.Final/standalone/tmp/vfs/temp6e0c35ea20e93021/content-85417a32e88feba4/aerogear-controller-demo/test.haml
> this path points to a non-existing place, the right one to return would be
> /Users/qmx/dev/jboss-as-7.1.1.Final/standalone/tmp/vfs/temp6e0c35ea20e93021/content-85417a32e88feba4/test.haml
> (note the stripped contextPath)
--
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