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

Re: Beta API questions (adding an extension)

From: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
Date: Fri, 26 Sep 1997 09:35:52 +0200
Message-Id: <199709260735.JAA05057@www43.inria.fr>
To: mark@intraspect.com
cc: www-jigsaw@w3.org, jigsaw@w3.org, bmahe@www43.inria.fr
> 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 ?

> 
>     // 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");
>   }
> 
> How would I do it now in the beta API?
> 
> Thanks in advance.
> 
> -Mark
> 

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

 The api has changed a lot.

 

 

- Benoît Mahé -------------------------------------------------------
World Wide Web Consortium                       bmahe@sophia.inria.fr 
Architecture domain - Jigsaw Team               tel : 04 93 65 79 89
---------------------------------------------------------------------
Received on Friday, 26 September 1997 03:36:30 GMT

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