Class w3c.jigsaw.http.httpd
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.http.httpd

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

public class httpd
extends Object
implements ServerHandler, 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.


Variable Index

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

Constructor Index

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

Method Index

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

Variables

 o version
  public final static String version
The current displayed version of Jigsaw.
 o verscount
  public final static int verscount
The current internal version counter of Jigsaw. This counter is bumped anytime the configuration needs upgrade.
 o VERSCOUNT_P
  public final static String VERSCOUNT_P
 o SERVER_SOFTWARE_P
  public final static 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.

 o HOST_P
  public final static 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).

 o ROOT_P
  public final static 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.

 o CONFIG_P
  public final static String CONFIG_P
Name of the property giving the server's config directory.
 o SPACE_P
  public final static 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.

 o PORT_P
  public final static 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.

 o TRACE_P
  public final static 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.

 o KEEP_ALIVE_P
  public final static 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.

 o KEEP_TIMEOUT_P
  public final static 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.

 o REQUEST_TIMEOUT_P
  public final static 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.

 o CLIENT_PRIORITY_P
  public final static 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.

 o CLIENT_BUFSIZE_P
  public final static 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.

 o CLIENT_DEBUG_P
  public final static 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.

 o USE_SM_P
  public final static 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.

 o LOGGER_P
  public final static 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 w3c.jigsaw.core.CommonLogger, which implements the common log format.

This property defaults to w3c.jigsaw.core.CommonLogger.

 o CLIENT_FACTORY_P
  public final static String CLIENT_FACTORY_P
Name of the property indicating the client factory class.
 o SHUFFLER_PATH_P
  public final static 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.

 o ROOT_STORE_P
  public final static String ROOT_STORE_P
Name of the property giving the root store of the server. The root store is the repository for the pickled version of the root resource.

This property defaults to the .jigidx file under the space directory.

 o ROOT_NAME_P
  public final static 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.

 o PROPS_P
  public final static 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.

 o FS_SENSITIVITY
  public final static 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.

 o 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.
 o 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.

 o 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
 o 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.

 o 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.

 o thread
  public Thread thread
 o timer
  public EventManager timer
 o root
  public HTTPResource root
This server root entity.

Constructors

 o httpd
  public httpd()
Create a new server instance in this process.
Parameters:
identifier - The server's identifier.
props - The server properties.

Methods

 o 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.
 o loadResource
  public HTTPResource 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.
 o checkpoint
  public void checkpoint()
Checkpoint all cached data, by saving them to disk.
 o registerPropertyEditor
  public synchronized void registerPropertyEditor(PropertyEditor propEditor)
 o registerPropertySet
  public synchronized void registerPropertySet(PropertySet set)
Register a property set to the server.
Parameters:
propSet - The property set to register.
 o initializePropertySets
  protected void initializePropertySets()
 o getStatistics
  public httpdStatistics getStatistics()
Get this server statistics.
 o getProperties
  public ObservableProperties getProperties()
Get this server properties.
 o checkFileSystemSensitivity
  public boolean checkFileSystemSensitivity()
Is the underlying file-system case sensitive ?
Returns:
A boolean, true if file system is case sensitive, false otherwise.
 o getDocumentationURL
  public String getDocumentationURL()
Get the full URL of Jigsaw's documentation.
Returns:
A String encoded URL.
 o getClientDebug
  public final boolean getClientDebug()
Get the client's debug flags from the properties.
 o getClientKeepConnection
  public final boolean getClientKeepConnection()
Does this server wants clients to try keeping connections alive ?
 o getRequestTimeOut
  public final int getRequestTimeOut()
Get the request allowed time slice from the properties.
 o getConnectionTimeOut
  public final int getConnectionTimeOut()
Get the connection allowed idle time from the properties.
 o getClientThreadPriority
  public final int getClientThreadPriority()
Get the client's threads priority from the properties.
 o getClientBufferSize
  public final int getClientBufferSize()
Get the client's buffer size.
 o getHost
  public String getHost()
Get this server host name.
 o getPort
  public int getPort()
Get this server port number.
 o getRoot
  public HTTPResource getRoot()
Get the server current root resource.
 o getLogger
  public Logger getLogger()
Get the logger for that server.
Returns:
A Logger compatible instance, or null if no logger specified.
 o getEditRoot
  public synchronized HTTPResource 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
 o getURL
  public URL getURL()
Get the server URL.
 o getSoftware
  public String getSoftware()
Get the server software string.
 o getLocalPort
  public int getLocalPort()
Get the server local port
 o getIdentifier
  public String getIdentifier()
Get this server identifier.
 o getInetAddress
  public InetAddress getInetAddress()
Get the server inet address
Returns:
The INET address this server is listening to.
 o getRootDirectory
  public File getRootDirectory()
Get this server root directory.
 o getConfigDirectory
  public File getConfigDirectory()
Get this server config directory.
 o getAuthDirectory
  public File getAuthDirectory()
Get this server authentication directory.
 o getStoreDirectory
  public File getStoreDirectory()
Get this server store directory.
 o getIndexer
  public ResourceIndexer getIndexer()
Get this server resource indexer.
 o getRealmsCatalog
  public RealmsCatalog getRealmsCatalog()
Get this server realm catalog.
 o getResourceStoreManager
  public ResourceStoreManager getResourceStoreManager()
Get this server resourcestore manager.
 o 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.
 o 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
 o 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
 o 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.
 o 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
 o 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.
 o 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.
 o log
  public void log(String msg)
Emit a log message.
Parameters:
msg - The message to log.
 o 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.
 o errlog
  public void errlog(String msg)
Emit an error on behalf of the server.
Parameters:
msg - The error message.
 o 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.
 o errlog
  public void errlog(HTTPResource from,
                     String msg)
Another nice way of reporting errors from an HTTPResource.
Parameters:
from - The resource that trigered the error.
msg - The error message.
 o fatal
  public void fatal(Exception e,
                    String msg)
Emit a fatal error.
Parameters:
e - Any exception that caused the error.
msg - Any additional message.
 o fatal
  public void fatal(String msg)
 o 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.
 o warning
  public void warning(Exception e,
                      String msg)
Emit a warning.
Parameters:
e - Any exception.
msg - Any message.
 o 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
 o run
  public void run()
 o perform
  public Reply perform(Request request) throws HTTPException, ClientException
Perform the given request on behalf of this server.
Parameters:
request - The request to perform.
Returns:
A non-null Reply instance.
Throws: HTTPException
If some error occurs during processing the request.
 o 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: IOException
If some IO or network operation failed.
 o clone
  public ServerHandler clone(ServerHandlerManager shm,
                             String id,
                             ObservableProperties props) throws ServerHandlerInitException
 o getConfigResource
  public ContainerResource getConfigResource()
 o usage
  public static void usage()
 o upgrade
  public static void upgrade(int from,
                             int to,
                             String args[])
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index