You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Steven D. Majewski" <sd...@virginia.edu> on 2007/01/17 23:24:05 UTC

realpath: doesn't return realpath

The realpath input module doesn't seem to actually return the realpath
when used in the sitemap.

I have my application mounted outside of tomcat or the cocoon webapp.
( via ../../mount-table.xml )

What realpath:/mydir  returns is cocoon's real path + /mydir,
not the realpath of mydir.

How can I get the real realpath ?

I've found some other discussion of this in the archives, but I haven't
yet found a resolution. ( And the discussions I've looked at so far are
a couple years old -- wondering if there's any way or plan to fix  
this ? )


I'm running cocoon-2.1.9 on jakarta-tomcat-5.0.28.



-- Steve Majewski - University of Virginia Alderman Library


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


Re: relative paths in flowscript [was: realpath: doesn't return realpath]

Posted by "Steven D. Majewski" <sd...@virginia.edu>.
On Jan 18, 2007, at 3:44 AM, Nico Verwer wrote:

> Steven D. Majewski wrote:
>
> 		
> 		Looking for an alternative way of solving my problem:
> 		
> 		   What is the working directory for a flowscript ?
> 		
> 		If it's based on the directory of the script or the sitemap,
> 		then I can probably just construct a relative path.
> 		
>
> I wrote an input module for this, which might help. See http:// 
> wiki.apache.org/cocoon/SitemapPathModule .
> The version on the wiki is not up-to-date, so I will update the  
> code in the attachment.
>
> Best regards,
> Nico


Thanks, Nico.

	I had seen your module when I was googling this problem in the  
mailing list
archives, but I was trying to avoid having to deal with any  
customizations outside
of my sitemaps -- I'm not the one who does the builds ( except for my  
test server )
so it's simpler if I don't have to touch cocoon.xconf or the libraries.

	But after a bit of testing and crawling thru the sources, I  
discovered that
ContextPathModule does what I want. And, in fact, looks like it does  
it the same
way as your code, except that it is conditional on the path it is  
given, depending
on whether the path starts with a "/" :

>         try {
>             if(name.startsWith("/")) {
>                 return m_resolver.resolveURI 
> ("context:/"+name).getURI().substring("file:".length());
>             }
>             return m_resolver.resolveURI(name).getURI().substring 
> ("file:".length());
>         } catch( final IOException mue ) {
>             throw new ConfigurationException( "Cannot resolve  
> realpath", mue);
>         }

So {contextpath:./work} gets me the work directory in my (externally  
mounted) cocoon app.


The module naming is confusing: realpath doesn't return a Real path.
ContextPathModule, in the docs, is called both ContextPathModule and
ContextRealPathModule in the same paragraph -- and the examples use
{contextrealpath:./path}, which doesn't actually seem to work.

<http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html>

  I think I tried this earlier in the project, before I had figured  
out how to
   navigate the sources.


I see the error message above from ContextPathModule says "Cannot  
resolve realpath" :
maybe the author wanted to name it realpath and then discovered there  
was already
an existing (and misnamed) realpath module.  And to add more  
confusion to the new
cocoon user, there's also {request:contextPath}, which is, I guess,  
cocoon's applet
context, which is something yet again!


And, for the record, I tried creating a file from flowscript with a  
relative pathname,
just to see what the current working directory was, and it seems to  
leave the file in
my home directory. ( which is where I was when I ran the tomcat  
startup script in
/usr/local/java/jakarta-tomcat.../bin ).


-- Steve Majewski



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


RE: relative paths in flowscript [was: realpath: doesn't return realpath]

Posted by Nico Verwer <nv...@be-value.nl>.
Steven D. Majewski wrote:

		
		Looking for an alternative way of solving my problem:
		
		   What is the working directory for a flowscript ?
		
		If it's based on the directory of the script or the sitemap,
		then I can probably just construct a relative path.
		

I wrote an input module for this, which might help. See http://wiki.apache.org/cocoon/SitemapPathModule .
The version on the wiki is not up-to-date, so I will update the code in the attachment.
 
Best regards,
Nico
 

relative paths in flowscript [was: realpath: doesn't return realpath]

Posted by "Steven D. Majewski" <sd...@virginia.edu>.
Looking for an alternative way of solving my problem:

   What is the working directory for a flowscript ?

If it's based on the directory of the script or the sitemap,
then I can probably just construct a relative path.

-- Steve.  

On Jan 17, 2007, at 5:24 PM, Steven D. Majewski wrote:

>
> The realpath input module doesn't seem to actually return the realpath
> when used in the sitemap.
>
> I have my application mounted outside of tomcat or the cocoon webapp.
> ( via ../../mount-table.xml )
>
> What realpath:/mydir  returns is cocoon's real path + /mydir,
> not the realpath of mydir.
>
> How can I get the real realpath ?
>
> I've found some other discussion of this in the archives, but I  
> haven't
> yet found a resolution. ( And the discussions I've looked at so far  
> are
> a couple years old -- wondering if there's any way or plan to fix  
> this ? )
>
>
> I'm running cocoon-2.1.9 on jakarta-tomcat-5.0.28.
>
>
>
> -- Steve Majewski - University of Virginia Alderman Library
>
>
> ---------------------------------------------------------------------
> 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