> could it be possible to create/access a file resource outside the Tomcat
> container using getResource()
> or you really have to specify the absolute or relative path to where it
> resides?

According to the Servlets 2.4 specification ..

"The ServletContext interface can provide access only to the hierarchy of
static content documents that are part of the web application ... This
hierarchy of documents may exist in the server's file system, in a WAR file,
on a remote server, or at some other location."

If you consider the last two phrases (Remote server / Some other location),
there appears to be a lot of ambiguity as to what exactly CAN be served
through ServletContext.getResource()
Tomcat's implementation of ServletContext.getResource() does hint at some
kind of JNDI support,
but , I guess, as a simple rule, you should place your resources under
WEB-INF/


regards
Pramod Nair

----- Original Message -----
From: "randie ursal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 4:19 AM
Subject: Re: More File IO trouble


> i agree with that..coz that's how i create/access my file resources.
>
> but i have this question because i haven't tried this one yet....
>
> could it be possible to create/access a file resource outside the Tomcat
> container using getResource()
> or you really have to specify the absolute or relative path to where it
> resides?
>
> also, could my Servlet locate the classes/jars being set on the
> classpath environment variable  without
> placing those classes/jar files inside the Tomcat container?
>
> P.S
>
> thanks a lot
>  randie
>
> >
> >
> > Pramod Nair wrote:
> >
> >> As an aside to what Richard mentioned, You should use
> >> ServletContext.getResource(String resourcePath) method to access
> >> resources
> >> within your web application. This would help in making your web
> >> application
> >> more portable and easier to deploy.
> >>
> >> regards
> >>
> >> Pramod Nair
> >>
> >> ----- Original Message -----
> >> From: "Richard Yee" <[EMAIL PROTECTED]>
> >> To: <[EMAIL PROTECTED]>
> >> Sent: Saturday, September 07, 2002 11:10 PM
> >> Subject: Re: More File IO trouble
> >>
> >>
> >>
> >>
> >>> Monte,
> >>> The path that you show is a relative path and not an absolute path.
> >>> put a
> >>> leading '/' on the path and try it again.
> >>>
> >>> -Richard
> >>>
> >>>
> >>
> >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to