You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Shrotriya, Sumit" <Su...@westgroup.com> on 2003/01/06 15:35:18 UTC
Reading Property files...related to servlets
Hi All,
My application is a servlet and it uses another application that tries to
read a property file.
Now the problem is that this application was never designed to work along
with a servlet and
does not read its property file using a method like
getServletContext().getResourceAsStream("/foo.html");
Now the question that I have for you bright folks out there is how am I
supposed to go about
feeding this application its property file:)
Thanks,
-Sumit
-----Original Message-----
From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
Sent: Monday, January 06, 2003 9:07 AM
To: Tomcat Users List
Subject: RE: Relative paths in servlets?
Hi,
Did you try getServletContext().getResourceAsStream("/foo.html"); ?
Yoav Shapira
Millennium ChemInformatics
>-----Original Message-----
>From: Øyvind Hvamstad [mailto:oyvind@hvamstad.net]
>Sent: Monday, January 06, 2003 8:36 AM
>To: tomcat-user@jakarta.apache.org
>Subject: Relative paths in servlets?
>
>Hi, could anyone tell me how to access files using relative paths from a
>servlet? Say, if servlet is mapped to /bar and the file foo.html is in
>the webapps top dir. How do I access the foo.html file from the servlet.
>I tried ../foo.html, /foo.html and even
>getServletContext().getRealPath(/bar)+"/../foo.html" but none works.
>
>Any pointers?
>--
>Øyvind Hvamstad
>
>
>--
>To unsubscribe, e-mail: <mailto:tomcat-user-
>unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-
>help@jakarta.apache.org>
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Reading Property files...related to servlets
Posted by Andreas Probst <an...@gmx.net>.
Hi Sumit,
you could read the properties file yourself as InputStream,
create a temp file from this and pass this temp file or the real
path to the temp file to the other app. It shouldn't be bad for
performance, if only done once. But you can't write to it any
more, because it's temp.
Andreas
On 6 Jan 2003 at 8:35, Shrotriya, Sumit wrote:
> Hi All,
> My application is a servlet and it uses another application
> that tries to
> read a property file.
> Now the problem is that this application was never designed to
> work along with a servlet and does not read its property file
> using a method like
> getServletContext().getResourceAsStream("/foo.html");
> Now the question that I have for you bright folks out there is
> how am I
> supposed to go about
> feeding this application its property file:)
>
> Thanks,
> -Sumit
>
> -----Original Message-----
> From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> Sent: Monday, January 06, 2003 9:07 AM
> To: Tomcat Users List
> Subject: RE: Relative paths in servlets?
>
>
> Hi,
> Did you try getServletContext().getResourceAsStream("/foo.html");
> ?
>
> Yoav Shapira
> Millennium ChemInformatics
>
>
> >-----Original Message-----
> >From: Øyvind Hvamstad [mailto:oyvind@hvamstad.net]
> >Sent: Monday, January 06, 2003 8:36 AM
> >To: tomcat-user@jakarta.apache.org
> >Subject: Relative paths in servlets?
> >
> >Hi, could anyone tell me how to access files using relative
> >paths from a servlet? Say, if servlet is mapped to /bar and the
> >file foo.html is in the webapps top dir. How do I access the
> >foo.html file from the servlet. I tried ../foo.html, /foo.html
> >and even getServletContext().getRealPath(/bar)+"/../foo.html"
> >but none works.
> >
> >Any pointers?
> >--
> >Øyvind Hvamstad
> >
> >
> >--
> >To unsubscribe, e-mail: <mailto:tomcat-user-
> >unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail: <mailto:tomcat-user-
> >help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For
> additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>