Thanks for the tip Dave. With a little tweaking, this'll do what I need.

Gabriel

[EMAIL PROTECTED] wrote:


Gabriel,


I was looking into another issue, and came across this Input Module that looks like it does exactly what you want? It'll walk up a directory tree looking for a file.

See the following URLs (not in any specific order):

http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/modules/input/LocateResource.html

http://wiki.cocoondev.org/Wiki.jsp?page=InputModules
http://cocoon.apache.org/2.1/userdocs/concepts/modules.html
http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html

I didn't see much documentation specifically for LocateResource other than in the javadoc:

<quote sic="true">
public class LocateResource
extends AbstractInputModule
implements Composable, ThreadSafe
Loacte a resource in a resource tree. Any attribute name is interpreted as a URI with the last part being the resource name unless it ends with a slash. The URI is checked if the resource exists and the URI is returned. If the resource does not exist, the URI is shortened until the resource name is found and the new URI is returned. If no resource with the given name exists, null is returned.


A use case is to locate the closest menu file or when moving a site from a filesystem path == URL system from a httpd to Cocoon and provide similar functions to .htaccess files.

Example: for context:/some/path/to/a/file.xml the following URIs are tested: context:/some/path/to/a/file.xml, context:/some/path/to/file.xml, context:/some/path/file.xml, context:/some/file.xml, and context:/file.xml. For the attribute name context:/some/path/foo/ tests context:/some/path/foo/, context:/some/path/, context:/some/, and context:/ are tested.

The getAttribute() method will return the URI for the first match while getAttributeValues() will return an array of all existing paths. getAttributeNames() will return an Iterator to an empty collection.
</quote>


HTH.

Dave Day.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to