You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan Wielgus <li...@o2.pl> on 2004/01/06 14:14:02 UTC

Getting the current working directory

Hi,

I would like to get the _actual_ current working directory, as I
want to write files on the server. As I'm using Java for that, I
need to have the full path explicitly. I can't use the protocols
such as 'context:/' or 'cocoon:/'. 
I have my app in such a directory:
c:\cocoon-2.1.2\build\webapp\my-app-dir
but Java (embedded in a XSP page) recognizes only "c:\cocoon-2.1-2".
Are there any possibilities to get the actual directory and give it
to Java function as parameter without need to code it directly in
the XSP page?

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Getting the current working directory

Posted by Jorg Heymans <jh...@domek.be>.
the "actual current working directory" is a bit ambiguous here. For java 
it will always be the directory from where the application is started from.

I can think of ugly non portable hacks using
Runtime.getRuntime().exec("insert your external program here");

but surely you can save yourself this mess and just set it as a 
configuration property :)

hth
Jorg

Jan Wielgus wrote:

> Hi,
> 
> I would like to get the _actual_ current working directory, as I
> want to write files on the server. As I'm using Java for that, I
> need to have the full path explicitly. I can't use the protocols
> such as 'context:/' or 'cocoon:/'. 
> I have my app in such a directory:
> c:\cocoon-2.1.2\build\webapp\my-app-dir
> but Java (embedded in a XSP page) recognizes only "c:\cocoon-2.1-2".
> Are there any possibilities to get the actual directory and give it
> to Java function as parameter without need to code it directly in
> the XSP page?
> 
> Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Getting the current working directory

Posted by Jan Wielgus <li...@o2.pl>.
>Jan,
>
>I don't know the details of your configuration, but what is the
RealPath
>input module returning?
>As a test, try one of the samples:
>http://localhost:8080/cocoon/samples/modules/realpath.xsp (modify
for your
>environment)

That is exactly that what I need:) Thank you very very much!:))

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Getting the current working directory

Posted by Hugo Burm <hu...@xs4all.nl>.
Jan,

I don't know the details of your configuration, but what is the RealPath
input module returning?
As a test, try one of the samples:
http://localhost:8080/cocoon/samples/modules/realpath.xsp (modify for your
environment)

And what do you exaclty mean with: "but Java (embedded in a XSP page)
recognizes only c:\cocoon-2.1-2.". Recognizes from what input?

Hugo


> -----Original Message-----
> From: Jan Wielgus [mailto:list40@o2.pl]
> Sent: Tuesday, January 06, 2004 2:14 PM
> To: users@cocoon.apache.org
> Subject: Getting the current working directory
>
>
> Hi,
>
> I would like to get the _actual_ current working directory, as I
> want to write files on the server. As I'm using Java for that, I
> need to have the full path explicitly. I can't use the protocols
> such as 'context:/' or 'cocoon:/'.
> I have my app in such a directory:
> c:\cocoon-2.1.2\build\webapp\my-app-dir
> but Java (embedded in a XSP page) recognizes only "c:\cocoon-2.1-2".
> Are there any possibilities to get the actual directory and give it
> to Java function as parameter without need to code it directly in
> the XSP page?
>
> Jan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org