You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jesse Kuhnert <jk...@gmail.com> on 2006/02/14 00:36:56 UTC

Re: Real path of the app server

new File(".").getAbsolutePath() ?

On 2/13/06, Lindsay Steele <lg...@gmail.com> wrote:
>
> This should be simple but I just can't find it.
>
> I need to know from within tapestry the real path to the current
> webserver so that it can be used when uploading.
>
> eg .. c:\Tomcat 5.5\  or   /var/tomcat
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Real path of the app server

Posted by Lindsay Steele <ls...@iinet.net.au>.
Thanks heaps Dmitry - this works fantastic and is exactly what I was 
looking for.

 I was trying a few other things such as the getRealPath but they didn't 
give the root of the web server and they came
up with all sorts of deprecation warnings, was working on putting 
something in build scripts .. but this should work better.


Dmitry Gusev wrote:
> Tomcat sets system property "catalina.home" at runtime. I guess other app
> servers does similiar things. Try to get it like:
>
> System.getProperty("catalina.home");
>
> On 2/14/06, Daniel Lydiard <dl...@hotmail.com> wrote:
>   
>> Isn't there a ServletContext getRealPath() that does something like that?
>>
>> ----- Original Message -----
>> From: "Lindsay Steele" <ls...@iinet.net.au>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Monday, February 13, 2006 3:51 PM
>> Subject: Re: Real path of the app server
>>
>>
>>     
>>> Unless I am mistaken .. but from my testing this only gives me the path
>>> of a file once it has been written.
>>>
>>> I can decide where to write a file by giving it a hard coded location -
>>> but I need something that goes across different OS's.
>>>
>>> If I could find where the web server is I could better choose where to
>>> write the file.
>>>
>>> The other alternative is to just let it write the file and then move it
>>> .. but this could make things a bit messy unless I can control
>>> where it writes the file.
>>>
>>> Would be best if there was some way to get the real path on disk of the
>>> web server.
>>>
>>>
>>> Jesse Kuhnert wrote:
>>>       
>>>> new File(".").getAbsolutePath() ?
>>>>
>>>> On 2/13/06, Lindsay Steele <lg...@gmail.com> wrote:
>>>>
>>>>         
>>>>> This should be simple but I just can't find it.
>>>>>
>>>>> I need to know from within tapestry the real path to the current
>>>>> webserver so that it can be used when uploading.
>>>>>
>>>>> eg .. c:\Tomcat 5.5\  or   /var/tomcat
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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: Real path of the app server

Posted by Dmitry Gusev <dm...@gmail.com>.
Tomcat sets system property "catalina.home" at runtime. I guess other app
servers does similiar things. Try to get it like:

System.getProperty("catalina.home");

On 2/14/06, Daniel Lydiard <dl...@hotmail.com> wrote:
>
> Isn't there a ServletContext getRealPath() that does something like that?
>
> ----- Original Message -----
> From: "Lindsay Steele" <ls...@iinet.net.au>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Monday, February 13, 2006 3:51 PM
> Subject: Re: Real path of the app server
>
>
> > Unless I am mistaken .. but from my testing this only gives me the path
> > of a file once it has been written.
> >
> > I can decide where to write a file by giving it a hard coded location -
> > but I need something that goes across different OS's.
> >
> > If I could find where the web server is I could better choose where to
> > write the file.
> >
> > The other alternative is to just let it write the file and then move it
> > .. but this could make things a bit messy unless I can control
> > where it writes the file.
> >
> > Would be best if there was some way to get the real path on disk of the
> > web server.
> >
> >
> > Jesse Kuhnert wrote:
> >> new File(".").getAbsolutePath() ?
> >>
> >> On 2/13/06, Lindsay Steele <lg...@gmail.com> wrote:
> >>
> >>> This should be simple but I just can't find it.
> >>>
> >>> I need to know from within tapestry the real path to the current
> >>> webserver so that it can be used when uploading.
> >>>
> >>> eg .. c:\Tomcat 5.5\  or   /var/tomcat
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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: Real path of the app server

Posted by Daniel Lydiard <dl...@hotmail.com>.
Isn't there a ServletContext getRealPath() that does something like that?

----- Original Message ----- 
From: "Lindsay Steele" <ls...@iinet.net.au>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, February 13, 2006 3:51 PM
Subject: Re: Real path of the app server


> Unless I am mistaken .. but from my testing this only gives me the path 
> of a file once it has been written.
> 
> I can decide where to write a file by giving it a hard coded location - 
> but I need something that goes across different OS's.
> 
> If I could find where the web server is I could better choose where to 
> write the file.
> 
> The other alternative is to just let it write the file and then move it 
> .. but this could make things a bit messy unless I can control
> where it writes the file.
> 
> Would be best if there was some way to get the real path on disk of the 
> web server.
> 
> 
> Jesse Kuhnert wrote:
>> new File(".").getAbsolutePath() ?
>>
>> On 2/13/06, Lindsay Steele <lg...@gmail.com> wrote:
>>   
>>> This should be simple but I just can't find it.
>>>
>>> I need to know from within tapestry the real path to the current
>>> webserver so that it can be used when uploading.
>>>
>>> eg .. c:\Tomcat 5.5\  or   /var/tomcat
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Real path of the app server

Posted by Lindsay Steele <ls...@iinet.net.au>.
 Unless I am mistaken .. but from my testing this only gives me the path 
of a file once it has been written.

 I can decide where to write a file by giving it a hard coded location - 
but I need something that goes across different OS's.

If I could find where the web server is I could better choose where to 
write the file.

The other alternative is to just let it write the file and then move it 
.. but this could make things a bit messy unless I can control
where it writes the file.

Would be best if there was some way to get the real path on disk of the 
web server.


Jesse Kuhnert wrote:
> new File(".").getAbsolutePath() ?
>
> On 2/13/06, Lindsay Steele <lg...@gmail.com> wrote:
>   
>> This should be simple but I just can't find it.
>>
>> I need to know from within tapestry the real path to the current
>> webserver so that it can be used when uploading.
>>
>> eg .. c:\Tomcat 5.5\  or   /var/tomcat
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>     
>
>