Thanks a lot

It's exactly what i want.

Barry

At 16:09 14/02/2004, you wrote:
Hi Barry,

// Get path to WEB-INF
org.apache.axis.MessageContext msgContext =
org.apache.axis.MessageContext.getCurrentContext();
String strWebInf =
msgContext.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_
SERVLETLOCATION).toString();

// Use path to WEB-INF to read text file into properties
Properties propsConfig = new Properties();
propsConfig.load(new BufferedInputStream(new FileInputStream(new
File(strWebInf + "/Config.txt"))));

// Use path to WEB-INF to read text file into string
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new
File(strWebInf + "/Stuff.txt")));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int nData = bis.read();
while (nData != -1)
{
    baos.write(nData);
    nData = bis.read();
}
bis.close();
baos.flush();
baos.close();
String strStuff = baos.toString();


Jeff




----- Original Message -----
From: "Barry BURNEREAU" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 14, 2004 8:40 AM
Subject: Geting a file in WEB-INF from a web service


> Hello > > I'm adding some web service to an existing webapp written with servlet. > There is a configuration file in the web-inf directory. I'd like to read > this configuration file in the web service. > > In the servlet, I use servletcontext.getResourceAsStream(path). > > How could i do similar thing in the web service ? > > Thanks > > Barry >




Reply via email to