    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.jigsaw.http.httpd

    java.lang.Object
       |
       +----org.w3c.jigsaw.http.httpd

public class httpd
extends Object
implements ServerInterface, Runnable, PropertyMonitoring, Cloneable

The server main class. This class can be used either through its main method, to run a full httpd server, or simply by importing it into your app. This latter possibility allows you to export some of your application state through http.

The server itself uses this to report about memory consumption, running threads, etc.

##

CHECKURL_P
  Name of the property indicating the URL of Jigsaw's chekpointer.
CLIENT_BUFSIZE_P
  Nam eof the property giving the client output buffer size.
CLIENT_DEBUG_P
  Name of the property indicating wether client should be debuged.
CLIENT_FACTORY_P
  Name of the property indicating the client factory class.
CLIENT_PRIORITY_P
  Name of the client thread priority property.
CONFIG_P
  Name of the property giving the server's config directory.
debug
  debug flag
DOCURL_P
  Name of the property indicating the URL of Jigsaw's help.
EDIT_ROOT_P
  Name of the property that indicates the root resource for edit.
FS_SENSITIVITY
  Name of the property indicating if the file-system is case sensitive.
host
  FIXME check The server host name.
HOST_P
  Name of the server host property.
instances
KEEP_ALIVE_P
  Name of the server's keep alive flag.
KEEP_TIMEOUT_P
  Name of the server's connection time out property.
LOGGER_P
  Name of property indicating the logger class to use.
MAX_LOADED_STORE
MAX_LOADED_STORE_P
  Max number of store loaded in memory.
port
  FIXME check The server port.
PORT_P
  Name of the server port property.
props
  This server set of properties.
PROPS_P
  Name of the property giving the path of the property file.
PUBLIC_P
  Name of the property indicating the public methods allowed on that server.
REQUEST_TIMEOUT_P
  Name of the server's request time out property.
root
  This server root entity.
ROOT_CLASS_P
ROOT_NAME_P
  Name of the property giving the name of the root resource.
ROOT_P
  Name of the property giving the server root directory.
SERVER_GROUP_P
  UNIX - Name of the property that indicates the server group.
SERVER_SOFTWARE_P
  Name of the server software property.
SERVER_USER_P
  UNIX - Name of the property that indicates the server user.
SHUFFLER_PATH_P
  Name of the property giving the shuffler path.
SPACE_P
  Name of the property giving the server space directory.
thread
timer
TRACE_P
  Name of the server's trace property.
TRASHDIR_P
  Name of the property indicating the trash directory.
url
  FIXME check for clones This server URL.
USE_SM_P
  Name of property that indicates if some security manager is required.
verscount
  The current internal version counter of Jigsaw.
VERSCOUNT_P
version
  The current displayed version of Jigsaw.

##

httpd()
  Create a new server instance in this process.

##

checkFileSystemSensitivity()
  Is the underlying file-system case sensitive ?
checkpoint()
  Checkpoint all cached data, by saving them to disk.
cleanup(boolean)
  Cleanup the resources associated with this server context.
clone(ServerHandlerManager, String, ObservableProperties)
  clone this server
debug(boolean)
  Turn debugging on/off for this instance of httpd server.
enumeratePropertySet()
  Enumerate all the registered property sets
errlog(Client, String)
  Emit a server error on behalf of some client object.
errlog(Object, String)
  The prefered form for reporting errors.
errlog(Resource, String)
  Another nice way of reporting errors from an HTTPResource.
errlog(String)
  Emit an error on behalf of the server.
fatal(Exception, String)
  Emit a fatal error.
fatal(String)
  Emit a fatal error.
getAuthDirectory()
  Get this server authentication directory.
getBanner()
getClientBufferSize()
  Get the client's buffer size.
getClientDebug()
  Get the client's debug flags from the properties.
getClientKeepConnection()
  Does this server wants clients to try keeping connections alive ?
getClientThreadPriority()
  Get the client's threads priority from the properties.
getConfigDirectory()
  Get this server config directory.
getConfigResource()
  get this server config resource
getConnectionTimeOut()
  Get the connection allowed idle time from the properties.
getDefaultContext()
  Get the default resource context for that server.
getDocumentationURL()
  Get the full URL of Jigsaw's documentation.
getEditRoot()
  Get the server's edit root resource.
getHost()
  Get this server host name.
getIdentifier()
  Get this server identifier.
getIndexerDirectory()
  Get this server index directory
getIndexersCatalog()
  get the indexer catalog of this server
getInetAddress()
  Get the server inet address
getLocalPort()
  Get the server local port
getLogger()
  Get the logger for that server.
getPort()
  Get this server port number.
getProperties()
  Get this server properties.
getPropertySet(String)
  Get a property set matching a specific name
getRealmsCatalog()
  Get this server realm catalog.
getRequestTimeOut()
  Get the request allowed time slice from the properties.
getResourceSpace()
  Get this server resource space
getResourceStoreManager()
  Get this server resourcestore manager.
getRoot()
  Get the server current root resource.
getRootDirectory()
  Get this server root directory.
getRootReference()
  get the resource reference of the root resource of the server
getShuffler(Client)
  Get a shuffler for this server's client.
getSoftware()
  Get the server software string.
getSpaceDir()
  Get this server space diretory
getStatistics()
  Get this server statistics.
getStoreDirectory()
  Get this server store directory.
getTrashDirectory()
  Get the tracsh directory
getURL()
  Get the server URL.
initialize(ServerHandlerManager, String, ObservableProperties)
  Initialize a new HTTP server.
initializeProperties()
  FIXME protected for now to handle clones Initialize some of the servers instance values from properties.
initializePropertySets()
loadResource(String)
  Lookup the root store for some resource.
loadRoot(String)
  Dynamically change the root resource for the server.
log(Client, Request, Reply, int, long)
  Emit a log entry.
log(String)
  Emit a log message.
main(String[])
  debugging main
perform(RequestInterface)
  Perform the given request on behalf of this server.
propertyChanged(String)
  The property monitoring implementation.
registerPropertySet(PropertySet)
  Register a property set to the server.
restart()
  Restart the server properly.
run()
shutdown()
  Shutdown the server properly.
startCheckpoint()
  start the automatic checkpoint
trace(Client, String)
  Emit a server trace.
trace(String)
  Emit a server trace, on behalf of the server itself.
usage()
  this server's usage
warning(Exception, String)
  Emit a warning.
warning(String)
  Emit a warning.

##

version

     public static final String version

  The current displayed version of Jigsaw.

verscount

     public static final int verscount

  The current internal version counter of Jigsaw. This counter is bumped anytime the configuration needs upgrade.

debug

     public static final boolean debug

  debug flag

VERSCOUNT_P

     public static final String VERSCOUNT_P

SERVER_SOFTWARE_P

     public static final String SERVER_SOFTWARE_P

  Name of the server software property. The server software is the string that gets emited by Jigsaw on each reply, to tell the client what server emited the reply.

  This property defaults to Jigsaw/1.0a.

HOST_P

     public static final String HOST_P

  Name of the server host property. The host property should be set to the name of the host running this server.

  This property defaults to the local host name, although if you want directory listing to work propertly, you might need to provide the full host name (including its domain).

ROOT_P

     public static final String ROOT_P

  Name of the property giving the server root directory.

  The server root directory is used to deduce a bunch of defaults properties, when they don't have any specific values.

  This property has no defaults.

CONFIG_P

     public static final String CONFIG_P

  Name of the property giving the server's config directory.

SPACE_P

     public static final String SPACE_P

  Name of the property giving the server space directory. The server space directory should contain an index file, built with the indexer.

  This property defaults to /WWW.

PORT_P

     public static final String PORT_P

  Name of the server port property. At initializatiojn time, the server will bind its accepting socket to the host its runs on, and to the provided port.

  This property defaults to `8888`.

TRACE_P

     public static final String TRACE_P

  Name of the server's trace property. When set to true, the server will emit some traces indicating its current state by using the logger trace methods. This property should be set to true if you want clients to emit traces.

  This property defaults to false.

KEEP_ALIVE_P

     public static final String KEEP_ALIVE_P

  Name of the server's keep alive flag. This property is used to determine wether this server should keep its connection alive. Keeping connection alive requires this flag to set to true, and clients to be compliant to the keep alive feature as described in HTTP/1.1 specification.

  This property defaults to true.

KEEP_TIMEOUT_P

     public static final String KEEP_TIMEOUT_P

  Name of the server's connection time out property. This property gives, in milliseconds, the timeout to use for connections that remains idel, waiting for an incoming request.

  This property defaults to `10000` milliseconds.

REQUEST_TIMEOUT_P

     public static final String REQUEST_TIMEOUT_P

  Name of the server's request time out property. The request time out property value indicates, in milliseconds, the allowed duration of a request. Any request whose duration exceeds this time out value will be aborted.

  This property defaults to `60000`.

CLIENT_PRIORITY_P

     public static final String CLIENT_PRIORITY_P

  Name of the client thread priority property. Every client threads will run at the given priority, which should be in the range of valid threads priority.

  This property defaults to `Thread.NORM_PRIORITY`.

CLIENT_BUFSIZE_P

     public static final String CLIENT_BUFSIZE_P

  Nam eof the property giving the client output buffer size. Each clients, when not using a shuffler, has to allocate its own output buffer, Output buffer size may increase/decrease significantly the Jigsaw performances, so change it with care.

  This property defaults to `8192`.

CLIENT_DEBUG_P

     public static final String CLIENT_DEBUG_P

  Name of the property indicating wether client should be debuged. When debuged, clients emit some traces, through the server logger about their current state.

  This property defaults to false.

USE_SM_P

     public static final String USE_SM_P

  Name of property that indicates if some security manager is required. You usually don't want to run a security manager for the server, except in the unlikely (right now) case that you want the server to be able to host agents.

  This property defaults to false.

LOGGER_P

     public static final String LOGGER_P

  Name of property indicating the logger class to use. The Jigsaw server allows you to implement your own logger. The only logger provided with the core server is the `org.w3c.jigsaw.core.CommonLogger`, which implements the common log format.

  Property defaults to `org.w3c.jigsaw.core.CommonLogger`

CLIENT_FACTORY_P

     public static final String CLIENT_FACTORY_P

  Name of the property indicating the client factory class.

SHUFFLER_PATH_P

     public static final String SHUFFLER_PATH_P

  Name of the property giving the shuffler path. This property should be set if you are to use the shuffler. The data shuffler is an external process to whiuch Jigsaw delegates the task of writing back document content to clients. Use this when you think your server isn't fast enough.

  This should be an absloute path.

  This property has no defaults.

ROOT_NAME_P

     public static final String ROOT_NAME_P

  Name of the property giving the name of the root resource. Upon startup, or restart, the server will look in its root store a resource whose name is given by this resource, and install it as its root resource.

  This property defaults to `root`.

ROOT_CLASS_P

     public static final String ROOT_CLASS_P

MAX_LOADED_STORE_P

     public static final String MAX_LOADED_STORE_P

  Max number of store loaded in memory.

MAX_LOADED_STORE

     public static final int MAX_LOADED_STORE

PROPS_P

     public static final String PROPS_P

  Name of the property giving the path of the property file. this should be used internally (for restart) only.

  This property defaults to `config/httpd.props`.

FS_SENSITIVITY

     public static final String FS_SENSITIVITY

  Name of the property indicating if the file-system is case sensitive. This property determines wether Jigsaw will list all files to check for case sensitivity, before creating a resource for that file.

  For obvious security reasons, this property defaults to true.

DOCURL_P

     public static String DOCURL_P

  Name of the property indicating the URL of Jigsaw's help. This URL should point to the URL path of Jigsaw's documentation as served by that server.

TRASHDIR_P

     public static String TRASHDIR_P

  Name of the property indicating the trash directory.

CHECKURL_P

     public static String CHECKURL_P

  Name of the property indicating the URL of Jigsaw's chekpointer.

PUBLIC_P

     public static String PUBLIC_P

  Name of the property indicating the public methods allowed on that server. This property should provide a `|` separated list of methods available on that server.

  This property defaults to: GET | HEAD | PUT | POST | OPTIONS | DELETE | LINK | UNLINK | TRACE.

EDIT_ROOT_P

     public static String EDIT_ROOT_P

  Name of the property that indicates the root resource for edit. The edit root resource is the one that will show up by default when accessing the FormResourceEditor.

  See Also:
    FormResourceEditor

SERVER_USER_P

     public static String SERVER_USER_P

  UNIX - Name of the property that indicates the server user. When set, the server will try to turn itself to the given user name after initialization. If this fail, the server will abort.

  This property has no default value.

SERVER_GROUP_P

     public static String SERVER_GROUP_P

  UNIX - Name of the property that indicates the server group. When set, the server will try to turn itself to the given group name after initialization. If this fail, the server will abort.

  This property has no default value.

thread

     public Thread thread

timer

     public EventManager timer

instances

     protected int instances[]

props

     protected ObservableProperties props

  This server set of properties.

host

     protected String host

  FIXME check The server host name.

port

     protected int port

  FIXME check The server port.

root

     public FramedResource root

  This server root entity.

url

     protected URL url

  FIXME check for clones This server URL.

##

httpd

     public httpd()

  Create a new server instance in this process.

  Parameters:
    identifier - The server's identifier.
    props - The server properties.

##

propertyChanged

     public boolean propertyChanged(String name)

  The property monitoring implementation.

  Parameters:
    name - The name of the property that has changed.
  Returns:
    A boolean, true if the changed was taken into account, false otherwise.

loadResource

     public ResourceReference loadResource(String name)

  Lookup the root store for some resource.

  Parameters:
    name - The name of the resource to lookup in the root store.
  Returns:
    The loaded resource, or null.

startCheckpoint

     public void startCheckpoint()

  start the automatic checkpoint

checkpoint

     public void checkpoint()

  Checkpoint all cached data, by saving them to disk.

loadRoot

     public synchronized ResourceReference loadRoot(String name)

  Dynamically change the root resource for the server. This is kind a dangerous operation !

  Parameters:
    name - The name of the new root resource, to be found in the root resource store.
  Returns:
    The new installed root resource, or null if we couldn't load the given resource.

initializeProperties

     protected void initializeProperties() throws ServerHandlerInitException

  FIXME protected for now to handle clones Initialize some of the servers instance values from properties.

  Throws: ServerHandlerInitException
    if unable to be initialized.

registerPropertySet

     public synchronized void registerPropertySet(PropertySet set)

  Register a property set to the server.

  Parameters:
    propSet - The property set to register.

enumeratePropertySet

     public Enumeration enumeratePropertySet()

  Enumerate all the registered property sets

  Returns:
    an enumeration of PropertySet

getPropertySet

     public Resource getPropertySet(String name)

  Get a property set matching a specific name

  Returns:
    a Resource, the property set found

initializePropertySets

     protected void initializePropertySets()

getStatistics

     public httpdStatistics getStatistics()

  Get this server statistics.

getProperties

     public ObservableProperties getProperties()

  Get this server properties.

checkFileSystemSensitivity

     public boolean checkFileSystemSensitivity()

  Is the underlying file-system case sensitive ?

  Returns:
    A boolean, true if file system is case sensitive, false otherwise.

getDocumentationURL

     public String getDocumentationURL()

  Get the full URL of Jigsaw's documentation.

  Returns:
    A String encoded URL.

getTrashDirectory

     public String getTrashDirectory()

  Get the tracsh directory

getClientDebug

     public final boolean getClientDebug()

  Get the client's debug flags from the properties.

getClientKeepConnection

     public final boolean getClientKeepConnection()

  Does this server wants clients to try keeping connections alive ?

getRequestTimeOut

     public final int getRequestTimeOut()

  Get the request allowed time slice from the properties.

getConnectionTimeOut

     public final int getConnectionTimeOut()

  Get the connection allowed idle time from the properties.

getClientThreadPriority

     public final int getClientThreadPriority()

  Get the client's threads priority from the properties.

getClientBufferSize

     public final int getClientBufferSize()

  Get the client's buffer size.

getHost

     public String getHost()

  Get this server host name.

getPort

     public int getPort()

  Get this server port number.

getRoot

     public FramedResource getRoot()

  Get the server current root resource.

getRootReference

     public ResourceReference getRootReference()

  get the resource reference of the root resource of the server

getLogger

     public Logger getLogger()

  Get the logger for that server.

  Returns:
    A Logger compatible instance, or null if no logger specified.

getEditRoot

     public synchronized ResourceReference getEditRoot()

  Get the server's edit root resource. The edit root is the one that shows up by default when using the FormResourceEditor resource.

  Returns:
    An HTTPResource.
  See Also:
    FormResourceEditor

getURL

     public URL getURL()

  Get the server URL.

getSoftware

     public String getSoftware()

  Get the server software string.

getLocalPort

     public int getLocalPort()

  Get the server local port

getIdentifier

     public String getIdentifier()

  Get this server identifier.

getInetAddress

     public InetAddress getInetAddress()

  Get the server inet address

  Returns:
    The INET address this server is listening to.

getRootDirectory

     public File getRootDirectory()

  Get this server root directory.

getSpaceDir

     public File getSpaceDir()

  Get this server space diretory

getConfigDirectory

     public File getConfigDirectory()

  Get this server config directory.

getAuthDirectory

     public File getAuthDirectory()

  Get this server authentication directory.

getStoreDirectory

     public File getStoreDirectory()

  Get this server store directory.

getIndexerDirectory

     public File getIndexerDirectory()

  Get this server index directory

getIndexersCatalog

     public IndexersCatalog getIndexersCatalog()

  get the indexer catalog of this server

getRealmsCatalog

     public RealmsCatalog getRealmsCatalog()

  Get this server realm catalog.

getResourceStoreManager

     public ResourceStoreManager getResourceStoreManager()

  Get this server resourcestore manager.

getResourceSpace

     public ResourceSpace getResourceSpace()

  Get this server resource space

getDefaultContext

     public ResourceContext getDefaultContext()

  Get the default resource context for that server.

cleanup

     protected synchronized void cleanup(boolean restart)

  Cleanup the resources associated with this server context. This method should only be called by the server thread itself, when it is requested to perform the cleanup.

  Parameters:
    restart - If true the server is restarted (reinitialized) straight away.

shutdown

     public synchronized void shutdown()

  Shutdown the server properly. This methods shutdown the server, and clean-up all its associated resources. If the current thread is not the server thread, it unblocks the server thread from its accept() call, and forces it to perform the rest of the shutdown operation itself.

  See Also:
    cleanup

restart

     public synchronized void restart()

  Restart the server properly. This methods restarts the server. It cleans-up all its associated resources, and reinitialize it from scratch. If the current thread is not the server thread, it unblocks the server thread from its accept() call, and forces it to perform the rest of the restart operation itself.

  Parameters:
    reload_properties - Should we reload the properties from the property file, or should we just reinitialize from the current set of properties.
  See Also:
    cleanup

debug

     public void debug(boolean onoff)

  Turn debugging on/off for this instance of httpd server.

  Parameters:
    A - boolean, true turns debugging on, flase turns it off.

trace

     public void trace(Client client,
                       String msg)

  Emit a server trace. Traces are used solely for debugging purposes. You should either use log or error to report informations.

  Parameters:
    client - The client object which wants to report the trace.
    msg - The trace message.
  See Also:
    error, log

trace

     public void trace(String msg)

  Emit a server trace, on behalf of the server itself.

  Parameters:
    msg - The trace the server wants to emit.

log

     public void log(Client client,
                     Request request,
                     Reply reply,
                     int nbytes,
                     long duration)

  Emit a log entry.

  Parameters:
    client - The client whose request is to be logged.
    request - The request that has been handled.
    reply - The emitted reply.
    nbytes - The number of bytes emitted back to the client.
    duration - The time it took to process the request.

log

     public void log(String msg)

  Emit a log message.

  Parameters:
    msg - The message to log.

errlog

     public void errlog(Client client,
                        String msg)

  Emit a server error on behalf of some client object.

  Parameters:
    client - The client.
    msg - The error message.

errlog

     public void errlog(String msg)

  Emit an error on behalf of the server.

  Parameters:
    msg - The error message.

errlog

     public void errlog(Object from,
                        String msg)

  The prefered form for reporting errors.

  Parameters:
    from - The object that emited the error.
    msg - The error message.

errlog

     public void errlog(Resource from,
                        String msg)

  Another nice way of reporting errors from an HTTPResource.

  Parameters:
    from - The resource that trigered the error.
    msg - The error message.

fatal

     public void fatal(Exception e,
                       String msg)

  Emit a fatal error.

  Parameters:
    e - Any exception that caused the error.
    msg - Any additional message.

fatal

     public void fatal(String msg)

  Emit a fatal error.

  Parameters:
    msg - Any error message

warning

     public void warning(String msg)

  Emit a warning. Warnings are emited, typically if the configuration is inconsistent, and the server can continue its work.

  Parameters:
    msg - The warning message.

warning

     public void warning(Exception e,
                         String msg)

  Emit a warning.

  Parameters:
    e - Any exception.
    msg - Any message.

getShuffler

     public synchronized Shuffler getShuffler(Client client)

  Get a shuffler for this server's client. Whenever possible, we use a shuffler program to speed up communication with the client. This methods return whatever the server deems appropriate for this client shuffler.

  Returns:
    A Shuffler instance, or null.
  See Also:
    Shuffler

getBanner

     protected String getBanner()

run

     public void run()

perform

     public ReplyInterface perform(RequestInterface req) throws ProtocolException, ResourceException

  Perform the given request on behalf of this server.

  Parameters:
    request - The request to perform.
  Returns:
    A non-null Reply instance.
  Throws: ProtocolException
    If some error occurs during processing the request.
  Throws: ResourceException
    If a resource got a fatal error.

initialize

     public void initialize(ServerHandlerManager shm,
                            String identifier,
                            ObservableProperties props) throws ServerHandlerInitException

  Initialize a new HTTP server. The server wil first be initialized from the available properties, it will than startup, and finally run in its own thread.

  Parameters:
    identifier - The string identifying this server's occurence.
    props - A set of properties to initialize from.
  Throws: ServerHandlerInitException
    if unable to be initialized.

clone

     public ServerHandler clone(ServerHandlerManager shm,
                                String id,
                                ObservableProperties props) throws ServerHandlerInitException

  clone this server

  Throws: ServerHandlerInitException
    if unable to be initialized.

getConfigResource

     public ResourceReference getConfigResource()

  get this server config resource

usage

     public static void usage()

  this server's usage

main

     public static void main(String args[])

  debugging main

    All Packages  Class Hierarchy  This Package  Previous  Next  Index