You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gr...@emc.com on 2005/05/12 15:35:45 UTC

Locating file from Axis Environment..

Looking for suggestion.

I'm running Axis 1.2 Final.  I have a Service that needs to locate a
configuration file that is special to itself.  Think of it as the equivalent
of server.xml for Tomcat.  

I need to put this file someplace, but obviously I don't want to hard code
it in the code.  I would like to keep it with the axis distribution just to
keep things local.  I would also like to make this platform independent.

The ultimate would be to place it in the axis WEB-INF directory, but I
suppose the lib directory with the service jar file would be ok.

Is there a way to obtain this directory at run time from the context of the
service method so that I can construct a java.io.File object to this file?

If not, anyone have any ideas how this might be done otherwise.

I don't was to depend on Tomcat configuration since I will want this service
to operate in other web servers.

  Thanks in advance.

    Cliff


-----------------------------------------------------------------------
Clifford Grimm 
Centera Integration Architect 
EMC Centera Engineering 
EMC² <http://www.emc.com/>  
Where Information Lives 
* Office: 508-249-5159 (toll free 877-362-2887 x45159) 
* Cell: 978-618-1336
* Fax: 508-249-5495
* E-mail: grimm_clifford@emc.com <ma...@emc.com> 
*  Instant Messaging: grimm_clifford@yahoo.com



Re: Locating file from Axis Environment..

Posted by Travis Reeder <tr...@ecommstats.com>.
Use

|this.getClass().getResource("/myfile");

and put your file in /WEB-INF/classes

Travis
|


Grimm_Clifford@emc.com wrote:

>Looking for suggestion.
>
>I'm running Axis 1.2 Final.  I have a Service that needs to locate a
>configuration file that is special to itself.  Think of it as the equivalent
>of server.xml for Tomcat.  
>
>I need to put this file someplace, but obviously I don't want to hard code
>it in the code.  I would like to keep it with the axis distribution just to
>keep things local.  I would also like to make this platform independent.
>
>The ultimate would be to place it in the axis WEB-INF directory, but I
>suppose the lib directory with the service jar file would be ok.
>
>Is there a way to obtain this directory at run time from the context of the
>service method so that I can construct a java.io.File object to this file?
>
>If not, anyone have any ideas how this might be done otherwise.
>
>I don't was to depend on Tomcat configuration since I will want this service
>to operate in other web servers.
>
>  Thanks in advance.
>
>    Cliff
>
>
>-----------------------------------------------------------------------
>Clifford Grimm 
>Centera Integration Architect 
>EMC Centera Engineering 
>EMC² <http://www.emc.com/>  
>Where Information Lives 
>* Office: 508-249-5159 (toll free 877-362-2887 x45159) 
>* Cell: 978-618-1336
>* Fax: 508-249-5495
>* E-mail: grimm_clifford@emc.com <ma...@emc.com> 
>*  Instant Messaging: grimm_clifford@yahoo.com
>
>
>
>  
>

-- 
Travis Reeder
Ecommstats Web Analytics
www.ecommstats.com