You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jean-Claude Moissinac <mo...@enst.fr> on 2004/07/21 19:42:01 UTC
current sitemap directory path
Hello
I'm searching to obtain the directory path (absolute or relative to the
main cocoon directory)
for the currently used sitemap.
I don't find a method.
I've traversed the doc, the sample...without result.
Many samples which seams to use such an information are hard coded and
become false if there are moved
See, for exemple, the samples:
/samples/modules/realpath.html
/samples/sources/xsp/file
...
and how they works.
I think it is possible to get this information but finding howto is very
difficult.
Is there a Cocoon gourou which can help me?
Jean-Claude Moissinac
Re: current sitemap directory path
Posted by Jean-Claude Moissinac <mo...@enst.fr>.
As soon as I try to use the resolver like this:
path = resolver.resolveURI(".");
or
path = resolver.resolveURI("sitemap.xmap");
I get this error at compile time:
" Error: line (36) cannot access org.apache.excalibur.source.SourceResolver
file
org\apache\excalibur\source\SourceResolver.class not found"
I have this line in my source
import org.apache.cocoon.environment.SourceResolver;
And I don't find a path in my cocoon tree for org\apache\excalibur\
So I'm unable to use SourceResolver.
Carsten Ziegeler wrote:
>You have to use the SourceResolver. Each sitemap component (action,
>generator, transformer) gets this object either in the act() method
>or in the setup() method.
>if you pass a relative path into the SOurcerResolver it's resolved
>relative to the current sitemap.
>
>HTH
>Carsten
>
>
>
>>...
>>Hello
>>
>>I'm searching to obtain the directory path (absolute or
>>relative to the main cocoon directory) for the currently used sitemap.
>>I don't find a method.
>>I've traversed the doc, the sample...without result.
>>
>>Many samples which seams to use such an information are hard
>>coded and become false if there are moved See, for exemple,
>>the samples:
>>/samples/modules/realpath.html
>>/samples/sources/xsp/file
>>...
>>and how they works.
>>
>>...
>>
>>
>
>
>
>
Re: current sitemap directory path
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Carsten" == Carsten Ziegeler <cz...@s-und-n.de> writes:
Carsten> Colin Paul Adams wrote:
>> But this is only a solution when a Source object is what you
>> want. This is not the case for me. I need this information
>> from WITHIN a Source object, as I need to pass an absolute
>> directory path to a Berkeley DB XML API.
>>
>> I tried using context.getRealPath ( request.getSitemapPath ()
>> ), but this does not give the correct answer when the sitemap
>> concerned is mount from the mount table (and thus is not within
>> the cocoon build/webapp directory. So how do I go about it?
Carsten> Ok, then you can lookup the SourceResolver in your
Carsten> SourceFactory, pass the resolver to your Source object,
Carsten> resolve your path in the Source object and get the
Carsten> absolute path from Source object.
I'm having problems with this approach.
I am getting:
Initialization Problem
Message: Could not find component (key [org.apache.excalibur.source.SourceResolver]) (Key='org.apache.excalibur.source.SourceResolver')
Description: org.apache.avalon.framework.service.ServiceException: Could not find component (key [org.apache.excalibur.source.SourceResolver]) (Key='org.apache.excalibur.source.SourceResolver')
Sender: org.apache.cocoon.servlet.CocoonServlet
Source: Cocoon Servlet
cause
org.apache.avalon.framework.context.ContextException: Unable to locate object-model (No environment available)
as soon as I attempt to access any cocoon uri.
I tried instead to pass the service manager to the Source, so it could
fetch the source resolver, and then release it, but this makes no
difference.
I added an implementation for Servicable to my SourceFactory, in order
to get the ServiceManager (so as to get the SourceResolver). Is there
anything else I need to do?
--
Colin Paul Adams
Preston Lancashire
RE: current sitemap directory path
Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Colin Paul Adams wrote:
>
> But this is only a solution when a Source object is what you want.
> This is not the case for me. I need this information from
> WITHIN a Source object, as I need to pass an absolute
> directory path to a Berkeley DB XML API.
>
> I tried using context.getRealPath ( request.getSitemapPath ()
> ), but this does not give the correct answer when the sitemap
> concerned is mount from the mount table (and thus is not
> within the cocoon build/webapp directory.
> So how do I go about it?
Ok, then you can lookup the SourceResolver in your SourceFactory,
pass the resolver to your Source object, resolve your path
in the Source object and get the absolute path from Source object.
Carsten
Re: current sitemap directory path
Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>> -----Original Message----- From: Jean-Claude Moissinac
>> Many samples which seams to use such an information are hard
>> coded and become false if there are moved See, for exemple, the
>> samples: /samples/modules/realpath.html
>> /samples/sources/xsp/file ... and how they works.
>>
>> I think it is possible to get this information but finding
>> howto is very difficult. Is there a Cocoon gourou which can
>> help me?
>>>>> "Carsten" == Carsten Ziegeler <cz...@s-und-n.de> writes:
Carsten> You have to use the SourceResolver. Each sitemap
Carsten> component (action, generator, transformer) gets this
Carsten> object either in the act() method or in the setup()
Carsten> method. if you pass a relative path into the
Carsten> SOurcerResolver it's resolved relative to the current
Carsten> sitemap.
But this is only a solution when a Source object is what you want.
This is not the case for me. I need this information from WITHIN a
Source object, as I need to pass an absolute directory path to a
Berkeley DB XML API.
I tried using context.getRealPath ( request.getSitemapPath () ), but
this does not give the correct answer when the sitemap concerned is
mount from the mount table (and thus is not within the cocoon
build/webapp directory.
So how do I go about it?
--
Colin Paul Adams
Preston Lancashire
RE: current sitemap directory path
Posted by Carsten Ziegeler <cz...@s-und-n.de>.
You have to use the SourceResolver. Each sitemap component (action,
generator, transformer) gets this object either in the act() method
or in the setup() method.
if you pass a relative path into the SOurcerResolver it's resolved
relative to the current sitemap.
HTH
Carsten
> -----Original Message-----
> From: Jean-Claude Moissinac [mailto:moissinac@enst.fr]
> Sent: Wednesday, July 21, 2004 7:42 PM
> To: dev@cocoon.apache.org
> Subject: current sitemap directory path
>
> Hello
>
> I'm searching to obtain the directory path (absolute or
> relative to the main cocoon directory) for the currently used sitemap.
> I don't find a method.
> I've traversed the doc, the sample...without result.
>
> Many samples which seams to use such an information are hard
> coded and become false if there are moved See, for exemple,
> the samples:
> /samples/modules/realpath.html
> /samples/sources/xsp/file
> ...
> and how they works.
>
> I think it is possible to get this information but finding
> howto is very difficult.
> Is there a Cocoon gourou which can help me?
>
> Jean-Claude Moissinac
>
>