Well, i guess it depends on the treatment of the war file. On tomcat for
eaxmple where the WAR file is unpacked for execution, getResource() acts as
though you were running the app using a standard unpack class hierarchy.
When I call get resource, the path of the resource is the full system path,
e.g. on windows something like
"C:/java/tomcat/webapps/myapp/WEB-INF/classes/com/company/product/MyClass.cl
ass"

sam
----- Original Message -----
From: "Gang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 04, 2001 3:41 PM
Subject: ServletContext.getResource()


> I have a question about getResource().  When calling getResource() on a
web
> app (.war file), the context root should be mapped to the root of the jar
> file.   However, how about a oridinary servlet?  suppose I have the web
root
> at /htdocs/ and servlet directory is at /servlets/, and I have a servlet
> called YYY in servlets.  If YYY is calling ServletContext.getResource(),
> what should be the context root?  The web root or the directory where YYY
is
> at?
>
> >From the old archives, it seems should be the webroot, but since
> getResource() has changed (no longer accept http:// requests), and is used
> to get resources related to the webapp, it should be geting resource from
> the servlet root so it can be used to get properties files and etc.
>
> Thanks.
> Gang
>
>
___________________________________________________________________________
> 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