axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Leblanc <Se...@insightamerica.com>
Subject RE: Discovering the webapp path.
Date Wed, 07 Jan 2004 21:45:50 GMT
Thanks, that worked just great.

--
Sean LeBlanc
Software Developer
insightamerica
"Those who do not understand Unix are condemned to reinvent it, poorly."
--Henry Spencer

-----Original Message-----
From: Jeff [mailto:jeff@cogentlogic.com] 
Sent: Wednesday, January 07, 2004 1:25 PM
To: axis-user@ws.apache.org
Subject: Re: Discovering the webapp path.


A few people have provided the following solution is earlier postings. To
get .../WEB-INF, do:

org.apache.axis.MessageContext msgContext =
org.apache.axis.MessageContext.getCurrentContext();
String strWebInf =
msgContext.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_
SERVLETLOCATION).toString();


Jeff



----- Original Message ----- 
From: <Junaid.Bhatra@mro.com>
To: <axis-user@ws.apache.org>
Sent: Wednesday, January 07, 2004 2:45 PM
Subject: RE: Discovering the webapp path.


>
>
>
>
>
> You can try the following:
>
> String realWebInfPath = ctx.getRealPath("/WEB-INF");
>
> This should give you the abolute path to the the /WEB-INF folder 
> assuming your web app is not packaged up as a .war file (in this case 
> it will
return
> null). You can then work off there.
>
> - Junaid
>
>
>
>
>              "Robert Lowe"
>              <rmlowe@rmlowe.co
>              m>                                                         To
>                                        <axis-user@ws.apache.org>
>              01/07/2004 01:55                                           cc
>              PM
>                                                                    Subject
>                                        RE: Discovering the webapp path.
>              Please respond to
>              axis-user@ws.apac
>                   he.org
>
>
>
>
>
>
>
> getResourceAsStream() can be used to load any kind of file from the 
> classpath, not just .class files. For example, it can be used for 
> image files or configuration files--useful for loading any kind of 
> resource when you don't know or care about the nature of the 
> underlying filesystem.
>
> What it *can't* be used for however, is writing or modifying files, so
it's
> probably not useful to you.
>
> What I've done in the past is include a configuration parameter (e.g. 
> a servlet init-param) to specify the filesystem location of the webapp 
> directory. Of course that's one more thing that needs to be configured 
> at deployment time-- but I'm not aware of a better solution.
>
> Best regards,
>
> Robert Lowe
> http://RMLowe.com/
>
>
>
> -----Original Message-----
> From: Sean Leblanc [mailto:SeanL@insightamerica.com]
> Sent: Thursday, January 08, 2004 2:38 AM
> To: 'axis-user@ws.apache.org'
> Subject: RE: Discovering the webapp path.
>
>
> user.dir gives me the directory of the tomcat binary directory. I'm 
> not sure that will always and forever be the case?
>
> getResourceAsStream() I'm not familiar with. It looks like it's used 
> to load classes? Loading classes is actually why I was thinking there 
> should be a way to get access to the directory in question in the 
> first place.
>
> I need the path so that I can write some data to a file there.
>
> TIA,
>
> --
> Sean LeBlanc
> Software Developer
> insightamerica
> "Those who do not understand Unix are condemned to reinvent it, 
> poorly." --Henry Spencer
>
> -----Original Message-----
> From: Keith Bohnenberger [mailto:kbohnenberger@mcdonaldbradley.com]
> Sent: Wednesday, January 07, 2004 10:02 AM
> To: axis-user@ws.apache.org
> Subject: RE: Discovering the webapp path.
>
>
> You can try getting the java system property user.dir
> Why do you need the path?  Can you get away with using
> getResourceAsStream(...) instead?
>
>
> > -----Original Message-----
> > From: Sean Leblanc [mailto:SeanL@insightamerica.com]
> > Sent: Wednesday, January 07, 2004 11:40 AM
> > To: 'axis-user@ws.apache.org'
> > Subject: Discovering the webapp path.
> >
> > I'm hoping this isn't a FAQ somewhere. I did try googling and
> searching
> > the
> > mailing list. Here goes:
> >
> > Is there a way to, at runtime, discover the path that the webapp is
> in? I
> > can't really rely on the root path being any particular path and 
> > doing absolute path, because depending on how tomcat is started, 
> > root is in different places.
> >
> >
> > TIA,
> >
> > --
> > Sean LeBlanc
> > Software Developer
> > insightamerica
> > "Those who do not understand Unix are condemned to reinvent it,
> poorly."
> > --Henry Spencer
> > e-Mail Notice: This communication may contain sensitive information.
> If
> > you
> > are not the intended recipient, or believe that you have received 
> > this communication in error, do not print, copy, retransmit, 
> > disseminate,
> or
> > otherwise use the information contained herein for any purpose.
> Please
> > alert the sender that you have received this message in error and
> delete
> > the
> > copy that you received.
> e-Mail Notice: This communication may contain sensitive information.  
> If you are not the intended recipient, or believe that you have 
> received this communication in error, do not print, copy, retransmit, 
> disseminate, or otherwise use the information contained herein for any 
> purpose.  Please alert the sender that you have received this message 
> in error and delete the
> copy that you received.
>
>
e-Mail Notice: This communication may contain sensitive information.  If you
are not the intended recipient, or believe that you have received this
communication in error, do not print, copy, retransmit, disseminate, or
otherwise use the information contained herein for any purpose.  Please
alert the sender that you have received this message in error and delete the
copy that you received.

Mime
View raw message