you want to take a look at the

getServletContext().getResource*


methods.  These methods are implemented by the Servlet Container to allow
the servlet to access resources where ever they happend to be.. either
in a file, in a WAR file, in a database, however the container wants to
maintain it....

fernando




On Mon, 23 Apr 2001, Milt Epstein wrote:

> On Mon, 23 Apr 2001, Filip Hanik wrote:
>
> > Thread.currentThread().getContextClassLoader().getResourceAsStream
> >
> > picks up files in your WEB-INF/classes or WEB-INF/lib inside of a jar or zip
> [ ... ]
>
> I have seen this this construct mentioned a few times here:
>
> Thread.currentThread().getContextClassLoader().getResourceAsStream()
>
> but is this any different from:
>
> getContext().getResourceAsStream()
>
> (similar for getResource(), of course).
>
>
> > > -----Original Message-----
> > > From: Jim Downing [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, April 23, 2001 9:09 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Accessing a packaged file
> > >
> > >
> > > Hi,
> > > I'm trying to get a servlet to access a text file that has been packaged
> > > with the servlet in a .war file. Is it possible to access the file without
> > > knowing it's absolute path when deployed, and if so how?
> > >
> > > jim
> > >
> > >
> >
>
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> [EMAIL PROTECTED]
>

Reply via email to