axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Neward <T...@matmail.ucdavis.edu>
Subject RE: Finding a WEB Service's Directory
Date Thu, 12 Sep 2002 20:12:57 GMT
I can't remember off the top of my head--is there a way to get hold of the
servlet's ServletContext object from within an Axis service? That's got the
getResource() (and getResourceAsStream()) method, which operates directly
from the webapp's root directory.

I'm somewhat surprised that getClass().getClassLoader().getResource() didn't
work, though.

Ted Neward
Architect, UCDavis Account & Financial Services
http://www.javageeks.com
http://www.clrgeeks.com
 

-----Original Message-----
From: Andrew Vardeman [mailto:andrewv@iastate.edu]
Sent: Thursday, September 12, 2002 13:00
To: axis-user@xml.apache.org
Subject: Re: Finding a WEB Service's Directory


Larry,

http://marc.theaimsgroup.com/?l=axis-user&m=102035646915446&w=2

this gets you to the WEB-INF directory in the webapp.  I'm saving service 
configuration stuff there, though there have been some threads where people 
have suggested cleaner ways of getting configuration information.

Andrew

At 02:50 PM 9/12/2002 -0500, you wrote:

>How do I find the directory where my service's '.class' files reside (and
>from which they were loaded)?  I need to be able to read/write files
specific
>to my service, and its intallation directory would seem to be the right 
>place.
>
>Using Tomcat 4.0.4 and Axis beta 3, File() creates and opens always go to
>the <CATALINA_HOME>/bin directory. In other words:
>
>         File(".").getAbsolutePath();
>
>returns "C:\jakarta-tomcat-4.0.4\bin\."
>
>I do not wish to hard-code the path to my service
>(ie: <CATALINA_HOME>/webapps/axis/WEB-INF/classes/myservice) since it will 
>vary
>for each deployment container used (WEB Logic, Tomcat, etc).
>
>The file "test.txt" exists in the "myservice" subdirectory -and- in
>the "myservice/resource" subdirectory; I've tried:
>
>         URL = getClass.getClassLoader.getResource("test.txt");
>and
>         URL = getClass.getClassLoader.getSystemResource("test.txt");
>and
>         URL = 
> MessageContext.getCurrentContext.getClassLoader.getResource("test.txt");
>
>None of the above worked.
>
>Thanks & Regards,
>Larry



Mime
View raw message