W3C home > Mailing lists > Public > www-jigsaw@w3.org > September to October 1997

Re: Beta API questions (adding an extension)

From: Mark Friedman <mark@intraspect.com>
Date: Fri, 26 Sep 1997 10:09:20 -0700
Message-ID: <342BEC40.3BBEA403@intraspect.com>
To: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
CC: www-jigsaw@w3.org, jigsaw@w3.org, bmahe@www43.inria.fr
Benoit Mahe wrote:

> > In Jigsaw Alpha5, I used to do something like the following to
> > programmatically add an extension resource:
>  Could I know why you want to programmatically add an extension ?

First off, let me say: Why wouldn't I want to programmatically add an
extension? Jigsaw is (at least to us) more than just an HTTP server; it's
an HTTP framework and API. We use it to do a lot of things

More specifically, we currently add some extensions programmatically so
that we don't have to worry about doing it manually. We create and
distribute new versions of our server quite often and we don't want to
have to do thing manually. In the future we may want to allow our users to
add extensions without exposing JigAdmin to them.

>  Take a look at w3c.jigsaw.resources.DirectoryResource.java especially
>  the getIndexer(..) and the createDefaultResource(..) methods.

I appreciate the help, but it's not quite enough? For example, there was
nothing about extensions in the above. Can anybody take the example of the
alpha5 code below and rewrite them for beta1? Or maybe give me some
pseudocode? I'll hunt it down if I have to but I just hoped that somebody
on this list could do it more or less off the top of their head.

By the way, in alpha5 I figured it out by looking at the
w3c.jigsaw.indexer.ExtensionsEditor class. I notice that that class has
not changed for beta1. Given that the API has changed, I assume that the
ExtensionsEditor class is actually now dead code. Is that true?

>  The api has changed a lot.


Thanks in advance


> >
> >     // Add extension resources
> >     ResourceIndexer indexer = server.getIndexer();
> >     // Add extension resource for .exe
> >     if (indexer.loadExtension("exe") == null) {
> >       addExtension ("exe",
> >                     new MimeType ("application",
> >                                   "x-msdownload"),
> >                     indexer);
> >     }
> >
> > where addExtension is defined as:
> >
> >   static void addExtension (String extString,
> >                             MimeType type,
> >                             ResourceIndexer indexer) {
> >     FileResource ext = new FileResource();
> >     ext.setValue ("identifier", extString);
> >     indexer.registerExtension(ext);
> >     ext.setValue ("content-type", type);
> >     indexer.save();
> >     System.out.println("Added " + extString +
> >                        " extension resource to Jigsaw");
> >   }
Received on Friday, 26 September 1997 13:14:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:41:23 UTC