users@jax-rpc.java.net

Re: Properties for services

From: Dima Sennikov <D.Sennikov_at_PROZA.LVIV.UA>
Date: Fri, 18 Oct 2002 10:31:07 +0300

Hello,

getResourceAsStream(name)
name - name of the desired resource

But How get name? All classes and resources packed to war file. If
user want to change configuration he must repack war file. It is not
good. I can read file from file system like File conf = new
File(path); How get path? I can not use "c:\conf.xml" because Linux
has not disk c. Best variant is got location to my war file. like
"C:\jwsdp-1_0\webapps" or like "/home/local/jwsdp-1_0/webapps". and
load file File cong = new File(warLocation, "conf.xml" How can I do
it? or another way?

AP> Hi,

AP> One of the convinient way to load resources for your
AP> application, like XML configuration file is to use

AP> getResourceAsStream(String)

AP> method available on Class object.

AP> In your code where you need to load the file you can
AP> do
AP> something like that:

AP> this.getClass().getResourceAsStream()

AP> The resource will be looke up and loaded by the same
AP> class loader which was used to load your class.

AP> Read JavaDoc for details.

AP> Alexi

AP> --- Dima Sennikov <D.Sennikov_at_PROZA.LVIV.UA> wrote:
>> Hello All,
>>
>> My Webservice has configuration. I store it in xml
>> file. WebService
>> has not ServletContext or any Context. I try store
>> path to xml file
>> in System Properties, i do not get result. How can I
>> set path to xml
>> and get it in web Service methods.
>>
>> --
>> Best regards,
>> Dima
AP> mailto:D.Sennikov_at_proza.lviv.ua


AP> __________________________________________________
AP> Do you Yahoo!?
AP> Faith Hill - Exclusive Performances, Videos & More
AP> http://faith.yahoo.com



--
Best regards,
 Dima                            mailto:D.Sennikov_at_proza.lviv.ua