Jigsaw Frequently asked questions

# Jigsaw
Frequently Answered Questions

Jigsaw Home / Documentation Overview

# What is Jigsaw ?

- What's the purpose of Jigsaw, why yet another server ?
- Where can I get Jigsaw ?
- Why is Jigsaw written in Java ?
- Jigsaw is written in Java, it must be really slow...

# Using Jigsaw

- The admin server reply "Method GET not implemented.", how can I use it?
- What's this indexing thing all about ?
- How do I setup authentication ?
- How do I tie a resource to a directory not under my server root?[Sirilyan sirilyan@io.com]
- How do I setup a CGI script ?
- How can I use php3 in Jigsaw?
- How can I use jsp in Jigsaw?
- How do I setup Jigsaw as a proxy ?
- How do I setup virtual hosting in Jigsaw ?
- How do I set the default document?
- How to add a new Mime Type in Jigsaw?
- Does Jigsaw support SSL?
- What is the default Login Name and Password for JigAdmin?

# Technical stuff

- How can I extend Jigsaw ?
- How do I compile Jigsaw?
- Why does Jigsaw implements its own persistence mechanism ?
- How can I use HotJava on top of your HTTP client API ?
- Running Jigsaw on port 80 under UNIX
- Chrooting Jigsaw under UNIX
- Running Jigsaw as a NT service.

# Using Servlets

- What are servlets ?
- How do I compile jigsaw to use the servlets ?
- How do I install a servlet ?
- How do I configure a servlet indexer?
- How can I setup the servlets properties?
- How does Jigsaw load local servlet classes ?
- How can I load remote servlets ?

You think your question about Jigsaw is worth entering this list, you have a better formulation for some of the answers ? Mail to jigsaw@w3.org !

## What's the purpose of Jigsaw ?

Jigsaw is the new W3C reference server. Its main purpose is to demonstrate new protocol features as they are defined (such as HTTP/1.1 or PICS), and to provide the basis for experimentations in the field of server software (such as the provided MUX prototypical implementation).

## Where can I get Jigsaw ?

You can download Jigsaw distribution file in various formats, and using either ftp or http:

Windows zip files (1.5Mo)
  - FTP
  - HTTP
UNIX gzip tar file (700Ko)
  - FTP
  - HTTP

## Why is Jigsaw written in Java ?

Java has a number of advantages that fit well with our purposes. It provides portable threads and garbage collection, allows for a very dynamic server architecture. It's ability to move code around may be use in future development to experiment with the mobile code concept.

## Jigsaw is written in Java, it must be really slow...

No so true ! Check out the performance evaluation of Jigsaw, which indicates that it performs at least as well as the CERN server.

## The admin server reply "Method GET not implemented.", how can I use it?

The administration server does not use plain HTTP but a variant of it. The only tool available for now is an application called JigAdmin.

## What is this indexing thing all about ?

To a normal HTTP web-admin, Jigsaw's configuration process might look really strange...Jigsaw's design emphasis two different processing stage in serving documents:

Indexing stage
  When documents enter the Web
Serving stage
  When documents are served to clients

In short the rationale for separating these two stages is to make the serving stage as efficient as possible, by having the indexing stage prepare as much as possible the work. A document enter the WEB space the first time Jigsaw serves it; this happen behind the scene most of the time, and consist in creating a resource for the document to be served by querying a resource factory. The current resource factory can be configured to create various kind of resources based either on the file name extensions, or (in case of a directory) based on its name.

However, once a resource is created, it no longer reflects the settings of the resource factory (see the indexers); in some sense the information gets compiled so that at serving time, processing overhead is reduced as much as possible.

## How do I tie a resource to a directory not under my server root?
Contributed by Sirilyan <sirilyan@io.com>

CERN server implemented this through the Pass directive, which let you map a server path to an absolute path on your file system. Jigsaw uses the org.w3c.jigsaw.resources.PassDirectory resource.

COOKBOOK METHOD: Create a new resource with Add resources in JigAdmin at the location you want the new server path to exist. Assign whatever name you desire to the new resource, and assign org.w3c.jigsaw.resources.PassDirectory for the class. Edit this new resource to change the pass-target attribute to the absolute path to the directory you want to serve.

You may want to change the name attribute of the 'index' file in that directory to Overview.html. name and filename are two separate attributes in Jigsaw; this is also a poor man's (or a Win95/NT user's) symlink.

Serving directories outside your server root may be a security risk.

## How do I setup CGI scripts ?

They are two ways to setup CGI scripts. The manual way requires that you describe each script to the server. Let's say your script's path relative to the server root is `WWW/cgi-bin/myscript`. You will first have to create an appropriate org.w3c.tools.resources.FileResource with a org.w3c.jigsaw.frames.CgiFrame instance to wrap your script. See this tutorials to know how to create a resource in Jigsaw.

Then edit the newly created resource, and setup it's command line (the command line the server will use to run your script). Each line of the text field should represent one argument, the first one being the script full path.

You can also register files of a given extension as scripts, by using a specialized indexer. When required, you can even specify the interpreter to be run to execute the script (for example, under Windows 95, or NT).

## How can I use php3 in Jigsaw ?

This is quite easy, the best way is to do it directly using an indexer. php3 scripts will be handled as CGIs (so see the FAQ entry above).

You need first to compile php3 as a cgi interpreter, then configure the "php3" extension in your indexer using a FileResource and a CgiFrame, like aforementionned. Then, in your CgiFrame, set the "interpreter" field to your php binary, and "Generates Form" to true. (Note, this will work with Jigsaw 2.0.2 and up)

## How do I set the default document?

With JigAdmin select the the HTTPFrame (or subclass) associated to the DirectoryResource (or subclass) where you want to modify the default document. Then, set the "index" field to your default document (eg: index.html).

Note: Don't forget to commit and save your changes.

## Does Jisaw support SSL?

There was a SSL version of Jigsaw, done at IAIK. As of june 1999 the link to their SSL version of Jigsaw is back up!

## What is the default Login Name and Password for JigAdmin?

The default Login Name is: admin, the default Password is: admin.

This information is also available in the JigAdmin documentation.

## How can I extend Jigsaw ?

Jigsaw can be extended in a number of ways. Here are just three possible things you can play with, from the simplest to the complex ones:

- Writing new resource classes and new frame classes: you may want to read the tutorial on this subject before getting any further. You can think of this as being a n efficient replacement for CGI scripts, although this is a much more powerful environment to extend the server.
- Writing new filter classes: if you want to experiment with specific authentication needs, or if you require special logging formats. A tutorial on writing new filters is also available.
- Hacking Jigsaw. Right now you can just override any of the Jigsaw classes to replace its implementation. In the future, most of the interesting things that you can do this way will be turned into specific interfaces (as is already the case for logging right now).

## Why does Jigsaw implement its own persistence mechanism

Jigsaw implements its own persistence mechanism while RMI already provides a way to serialize objects, why is it so, will it change ? What Jigsaw implements in the `w3c.tools.store` package is more then persistence. It provides both a way of serializing objects and a way of describing what and how the object will be dumped. The available meta-description of objects (that you can obtain through the `getAttributes` method of resources), is a central part of Jigsaw architecture, since it offers the ability to create generic resource editors. This is not likely to disappear.

However, Jigsaw persistence mechanism may be merged in the future to the RMI interface, just by providing an implementation of the `readObject` and `writeObject` method through its existing mechanism.

## How can I use HotJava on top of Jigsaw's HTTP client API ?

HotJava is Sun's Java based browser. If you want to experience an HTTP/1.1 compliant browser, you can run this browser on top of Jigsaw's HTTP/1.1 compliant HTTP client API. To do so, you need to define the `java.protocol.handler.pkgs` property to `w3c.www.protocol` before launching HotJava. The best way to do so is to edit the HotJava property files.

Jigsaw's HTTP client API defines a number of other properties, if you are planing to use this setting, you should read the HttpManager documentation to get the complete list of available properties. These will allow you to add caching, authentication, proxying and more to HotJava !

## Running Jigsaw on port 80 under UNIX

As of release 1.0alpha5, Jigsaw can now run on port 80, without running as the root user. To implement that you need to install the relevant piece of native code. This C code has been compiled and tested under Solaris, porting it to a different platform/architecture should be pretty easy.

Follow the normal installation procedure, and try to run Jigsaw on a port greater than 1024. Once this work, stop Jigsaw (through `/Admin/Exit`), Make sure your LD_LIBRARY_PATH variable includes the directory containing `libUnix.so` (this is the `Jigsaw/lib` directory under the standard release).

Select the user and group you want Jigsaw to run as. Make sure that user has read/write access to the entire `config` directory. Then, you just need to run Jigsaw through that special command line:

`java org.w3c.jigsaw.Main -user user -group group <other-options>`

Where user and group should provide (resp.) the user and the group you want Jigsaw to run as.

Warning: As the underlying UNIX process will change personnality right after acquiring the socket, the form based restart button (available from the properties editor) will no longer work, since the process will no longer be able to allocate a socket on port 80.
Under such a setting, the only way to restart Jigsaw is to kill it (through `/Admin/Exit`) and restart it manually.

## Chrooting Jigsaw under UNIX

As of release 1.0alpha5, Jigsaw can now - under UNIX - be chroot'ed. If you try to do so, you are supposed to have some experiences with chroot'ing programs. We will assume that you already have a correct root to run a standard HTTP server and that you have read and understood the Running Jigsaw on port 80 FAQ entry.

You need to install Java in that root (using whatever prefered way you want). To install Jigsaw, I would recommend using the following directory structure:

/usr/local/jigsaw/classes
  Should contain Jigsaw's current distribution jigsaw.zip class file
/usr/local/jigsaw/extensions
  Is used to add extensions to the server while running, and should be included in your CLASSPATH, before you start Jigsaw.
/usr/local/jigsaw/lib
  Should contain Jigsaw's native code support - ie libUnix.so -(to make the appropriate UNIX system calls)

Given that (don't forget to symlink the real `/usr/local/jigsaw` to the chroot'ed one), you should be able to reuse that script:

     #!/bin/sh
    # Jigsaw
    # $Id: FAQ.html,v 1.42 2000/03/15 13:10:45 bmahe Exp $
    # Jigsaw launcher

    # LD_LIBRARY_PATH will be set to work *only* before chroot, by the java script
    # We add here, support for PATH as they appear to be after the chroot

    CR_LD_LIBRARY_PATH=/usr/local/jigsaw/lib:/usr/local/java/lib/sparc:/usr/lib:/lib
    LD_LIBRARY_PATH=$CR_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH

    # CLASSPATH needs two hacks: one to include jigsaw.zip before chroot, and
    # an other one to include everything after chroot

    CLASSPATH=/0/w3c/abaird/sbroot/usr/local/jigsaw/classes/jigsaw.zip:/0/w3c/abaird
    /sbroot/usr/local/jigsaw/classes/servlet.zip:/0/w3c/abaird/sbroot/usr/local/jigs
    aw/classes/plus.zip:/0/w3c/abaird/sbroot/usr/local/jigsaw/extensions
    export CLASSPATH
    CR_CLASSPATH=/usr/local/jigsaw/classes/jigsaw.zip:/usr/local/jigsaw/classes/serv
    let.zip:/usr/local/jigsaw/classes/plus.zip:/usr/local/jigsaw/extensions
    CLASSPATH=$CR_CLASSPATH:$CLASSPATH
    export CLASSPATH

    # Ready to run jigsaw, now:

    cd /0/w3c/abaird/sbroot/jigsaw
    exec /usr/local/java/bin/java org.w3c.jigsaw.daemon.ServerHandlerManager $* -group n
    obody -user nobody -chroot /0/w3c/abaird/sbroot -root /jigsaw

## Running Jigsaw as a NT service

To be able to run Jigsaw as a service, you may use a tool allowing java programs to run as a service. You just have to make your choice in this list. Remember that the safest way to shut down Jigsaw is to use the administration interface of JigKill