You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Eric Cuendet <je...@rptec.ch> on 2006/02/27 23:08:34 UTC

Getting servlet directory

Hi,
Is there a way to get the servlet directory from within Tapestry?
I need to know where it is to read images that I need to generate a PDF.
It's on my local machine /opt/tomcat/webapps/sympto/images but that
could/would be different when in production.
Thanks
-jec


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Getting servlet directory

Posted by James Carman <ja...@carmanconsulting.com>.
How do you know they're running Tomcat?  Ask the ServletContext for a "real
path":

File imagesDir = new File( servletContext.getRealPath( "/images" ) );

You can get the servlet context in Tapestry via injection(
tapestry.globals.ServletContext is the service name).



-----Original Message-----
From: Lindsay Steele [mailto:lsteele@iinet.net.au] 
Sent: Tuesday, February 28, 2006 6:02 AM
To: Tapestry users
Subject: Re: Getting servlet directory


String tomcatHome = System.getProperty("catalina.home");

Jean-Eric Cuendet wrote:
> Hi,
> Is there a way to get the servlet directory from within Tapestry?
> I need to know where it is to read images that I need to generate a PDF.
> It's on my local machine /opt/tomcat/webapps/sympto/images but that
> could/would be different when in production.
> Thanks
> -jec
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting servlet directory

Posted by Lindsay Steele <ls...@iinet.net.au>.
String tomcatHome = System.getProperty("catalina.home");

Jean-Eric Cuendet wrote:
> Hi,
> Is there a way to get the servlet directory from within Tapestry?
> I need to know where it is to read images that I need to generate a PDF.
> It's on my local machine /opt/tomcat/webapps/sympto/images but that
> could/would be different when in production.
> Thanks
> -jec
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org