I copied some words from the spec, the the second paragraph, it says
something about resources in the META-INF/resources directory, if we do not
need to care about whether the real file exists, I think we could never go
into this situation, we might always have a path in the default context.
right ?
--->
The getRealPath method takes a String argument and returns a String
representation of a file on the local file system to which a path
corresponds. The
getPathTranslated method computes the real path of the pathInfo of the
request.
In situations where the servlet container cannot determine a valid file path
for these
methods, such as when the Web application is executed from an archive, on a
remote
file system not accessible locally, or in a database, these methods must
return null.
Resources inside the META-INF/resources directory of JAR file must be
considered only if the container has unpacked them from their containing JAR
file
when a call to getRealPath() is made, and in this case MUST return the
unpacked
location.
<---

2010/7/28 Mark Thomas <ma...@apache.org>

> On 26/07/2010 03:20, Ivan wrote:
> > Hi,
> >     Seems that the doGetRealPath method in the FileDirContext returns the
> > path directly without checking the target file or folder exists, so is it
> > expected or file checking is required ?
>
> I don't see anything in the Servlet specification that says that the
> real path has to exist. Do you?
>
> Mark
>
> >     --->
> >     @Override
> >     protected String doGetRealPath(String path) {
> >         File file = new File(getDocBase(), path);
> >         return file.getAbsolutePath();
> >     }
> >    <---
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
Ivan

Reply via email to