Skip to main content

[JIRA] Commented: (SERVLET_SPEC-11) Clarification required for ServletContext.getRealPath and HttpServletRequest.getPathTranslated

  • From: "markt_asf (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Commented: (SERVLET_SPEC-11) Clarification required for ServletContext.getRealPath and HttpServletRequest.getPathTranslated
  • Date: Thu, 28 Jun 2012 22:26:55 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated


    [ 
http://java.net/jira/browse/SERVLET_SPEC-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=342180#action_342180
 ] 

markt_asf commented on SERVLET_SPEC-11:
---------------------------------------

If memory serves me correctly this wasn't a WAR/database/virtual vs local 
filesystem issue. If was purely in the context of a local file system when 
everything is unpacked.

Take, for example, a WAR with context path "/foo" unpacked on the local file 
system to "/usr/local/webapps/foo".

Assume that there also exists the directory "/usr/local/webapps/foo/bar"

When called from the "foo" web application, getRealPath("/bar") will return 
"/usr/local/webapps/foo/bar".

The question is, what should getRealPath("/other") return?

Should it:
a) return "/usr/local/webapps/foo/other" since that what it maps too?
b) return null since "/usr/local/webapps/foo/other" does not exist?

This really boils down to what does the specification mean by valid in 
section 3.6? I think we need to make it clear that "valid" does not mean 
"must exist".

I've dug through the archives and the Tomcat bug that prompted this request 
for clarification was this one: 
https://issues.apache.org/bugzilla/show_bug.cgi?id=51799

> Clarification required for ServletContext.getRealPath and 
> HttpServletRequest.getPathTranslated
> ----------------------------------------------------------------------------------------------
>
>                 Key: SERVLET_SPEC-11
>                 URL: http://java.net/jira/browse/SERVLET_SPEC-11
>             Project: servlet-spec
>          Issue Type: Bug
>            Reporter: markt_asf
>            Assignee: Rajiv Mordani
>
> There appear to be different interpretations of the required behaviour of 
> ServletContext.getRealPath(java.lang.String path) and 
> HttpServletRequest.getPathTranslated() if the virtual path can be mapped to 
> a physical path but the physical path does not exist.
> My reading of the specification and the Javadoc is that the physical path 
> does not have to exist, just that the mapping has to be possible. However, 
> I can see how someone else could read the specification as requiring the 
> physical path to exist and null to be returned if it does not.
> This should be clarified for Servlet 3.1 and ideally the clarification 
> included in any subsequent maintenance releases of the earlier 
> specification versions.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Commented: (SERVLET_SPEC-11) Clarification required for ServletContext.getRealPath and HttpServletRequest.getPathTranslated

Rajiv Mordani (JIRA) 06/28/2012

<Possible follow-up(s)>

[JIRA] Commented: (SERVLET_SPEC-11) Clarification required for ServletContext.getRealPath and HttpServletRequest.getPathTranslated

markt_asf (JIRA) 06/28/2012

[JIRA] Commented: (SERVLET_SPEC-11) Clarification required for ServletContext.getRealPath and HttpServletRequest.getPathTranslated

Rajiv Mordani (JIRA) 06/29/2012
 
 
Close
loading
Please Confirm
Close