W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2003

Re: NewStoreEntry, ResourceStoreManager, ContainerResource...

From: Yves Lafon <ylafon@w3.org>
Date: Wed, 26 Feb 2003 16:27:57 +0100 (MET)
To: Vladimir Jakobac <vjakobac@yahoo.com>
cc: www-jigsaw@w3.org
Message-ID: <Pine.GSO.4.53.0302261544180.6601@tarantula.inria.fr>

On Sun, 23 Feb 2003, Vladimir Jakobac wrote:

>
> Hi,
>
> I am trying to change the Jigsaw behavior in the
> following way: if the file name in the requested URI
> is incorrect, the server should return the list of all
> available resources in the directory where that file
> was expected to be. For example, for the following URI
> that is non-existing
> http://localhost:8001/User/Specifications/test.html,
> I would like to have displayed the result of
> http://localhost:8001/User/Specifications/
>
> I don't quite understand what the all situations are
> when tools.resources.ContainerResource's
> lookup(String) and internalLookup methods are invoked.
> For a single component from my URI list (e.g., User,
> index.html) the same method is called more than once
> and I still cannot figure out from where.

The lookup is done using lookup(LookupState, LookupResult)
inside lookup, a lookup(String) is done to select the next resource that
will handle the next step of the lookup.
Also, as the lookup can be interrupted during this process (see AclFilter
or GenericAuthFilter).
So the container calls its superclass lookup (checking if we should set
the target if there is more to do or not, and also calling the frames
lookup).
So, to achieve what you want to do, you may want to create another class
of container (extending Jigsaw's
org.w3c.jigsaw.resources.DirectoryResources)
and if the lookup(name) call return null, just set the target to the
resource reference of the calling directory and return true

        rr = lookup(name);
	if (rr == null) {
            lr.setTarget(getResourceReference());
	    return true;
	}

this will give the listing of the first directory where the lookup fail,
ie, not only for the last part. If it is only for the last part, you may
well add a test on the number of remaining components needed for the
lookup (ls.countRemainingCompoments()).
Hope this helps,

-- 
Yves Lafon - W3C
"Baroula que barouleras, au tiéu toujou t'entourneras."
Received on Wednesday, 26 February 2003 10:27:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:36 GMT