Re: NewStoreEntry, ResourceStoreManager, ContainerResource...

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 UTC