W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1998

Q: how to get jigadm to recognize new resource?

From: Jeff Van Epps <lordbah@lordbah.com>
Date: Fri, 13 Nov 1998 07:21:33 -0500 (EST)
Message-ID: <364C2398.2E4CF63B@lordbah.com>
To: www-jigsaw@w3.org
Okay, it looks like it's time to try customizing the source.

I want to create a directory node with this behavior:

- if child file exists, return it just like normal
- if not, return instead contents of a different URL

Example: directory called "bands". If "bands/119" exists (it'll be an HTML
file), return it. If not, invoke "/music/query.cgi?band=119".

[query.cgi is actually a servlet I've already got working (.cgi is

I wasn't sure where to start. I thought of different possibilities:

- extend DirectoryResource
- create a new Frame
- subclass RedirecterFrame

In the end I chose to subclass HttpDirectoryResource:

package org.w3c.jigsaw.resources ;

import java.util.*;
import java.io.*;
import java.net.*;
import org.w3c.tools.resources.LookupResult;
import org.w3c.tools.resources.LookupState;
import org.w3c.tools.resources.ProtocolException;
import org.w3c.www.http.*;
import org.w3c.jigsaw.http.*;

public class BandResource extends HttpDirectoryResource
    // Don't have any attributes, so the code which deals with the
    // attribute registry is omitted.

    public boolean lookup( LookupState ls, LookupResult lr )
        throws ProtocolException
        Request     req;
        Reply       reply;
        String      band;
        String      newurl;

        if ( super.lookup( ls, lr ) )
            return true;
        req = (Request) ls.getRequest();
        if ( req == null || ! req.getMethod().equals( "GET" ) )
            return false;
        reply = req.makeReply( HTTP.TEMPORARY_REDIRECT );
        band = ls.getRemainingPath();
        band = ( band == null ) ? "null" : band;
        newurl = getServer().getURL() + "/music/query.cgi?band=" + band;
        System.out.println( "redir to " + newurl );
            reply.setLocation( new URL( newurl ) );
        } catch( Exception e )
        reply.setContent( "Try " + newurl );
        lr.setReply( reply );
        return true;

This compiled, but it doesn't show up in jigadm as a choice for resource
Hunting around in the source, there appear to be property files which need
be edited to include the new class (I must have missed this in the
on how to compile and install a resource - I still can't find it). I looked
for HttpDirectoryResource, and found it in two ResourceHelper.p files, so I
added BandResource right after it in both. But jigadm now refuses to show me
ANY resource helper, always throwing an exception claiming that there was a
configuration error, no editor for whatever resource I selected.

Can anyone point me to instructions for getting jigadm to recognize the new

Beyond that, I would appreciate any comments on whether this is the correct
approach to solve the problem.


Jeff Van Epps  lordbah@lordbah.com
Received on Sunday, 15 November 1998 23:35:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:33 UTC