|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.jigsaw.http.httpd
public class httpd
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.
Field Summary | |
---|---|
static java.lang.String |
CHECKURL_P
Name of the property indicating the URL of Jigsaw's chekpointer. |
static java.lang.String |
CLIENT_BUFSIZE_P
Nam eof the property giving the client output buffer size. |
static java.lang.String |
CLIENT_DEBUG_P
Name of the property indicating wether client should be debuged. |
static java.lang.String |
CLIENT_FACTORY_P
Name of the property indicating the client factory class. |
static java.lang.String |
CLIENT_PRIORITY_P
Name of the client thread priority property. |
static java.lang.String |
CONFIG_P
Name of the property giving the server's config directory. |
static boolean |
debug
debug flag |
static java.lang.String |
DEFHOSTIP_P
If the Host property is not set (see below), you can select if you want to use FQDN (broken on some jdk implementation) or just the IP address as the default host name, it usually defaults to "false" means, use FQDN. |
static java.lang.String |
DISPLAY_URL_ON_ERROR_P
Should we show the URL that triggered an error in the error message or not? Displaying it can lead to so-called "cross-scripting" hacks |
static java.lang.String |
DOCURL_P
Name of the property indicating the URL of Jigsaw's help. |
static java.lang.String |
EDIT_ROOT_P
Name of the property that indicates the root resource for edit. |
static java.lang.String |
FS_SENSITIVITY
Name of the property indicating if the file-system is case sensitive. |
protected java.lang.String |
host
FIXME check The server host name. |
static java.lang.String |
HOST_P
Name of the server host property. |
protected int[] |
instances
|
static java.lang.String |
KEEP_ALIVE_P
Name of the server's keep alive flag. |
static java.lang.String |
KEEP_TIMEOUT_P
Name of the server's connection time out property. |
static java.lang.String |
LENIENT_P
Name of property indicating the "lenient" mode of HTTP parsing. |
static java.lang.String |
LOGGER_P
Name of property indicating the logger class to use. |
static int |
MAX_LOADED_STORE
|
static java.lang.String |
MAX_LOADED_STORE_P
Max number of store loaded in memory. |
protected int |
port
FIXME check The server port. |
static java.lang.String |
PORT_P
Name of the server port property. |
protected ObservableProperties |
props
This server set of properties. |
static java.lang.String |
PROPS_P
Name of the property giving the path of the property file. |
static java.lang.String |
PUBLIC_P
Name of the property indicating the public methods allowed on that server. |
static java.lang.String |
REQUEST_TIMEOUT_P
Name of the server's request time out property. |
FramedResource |
root
This server root entity. |
static java.lang.String |
ROOT_CLASS_P
|
static java.lang.String |
ROOT_NAME_P
Name of the property giving the name of the root resource. |
static java.lang.String |
ROOT_P
Name of the property giving the server root directory. |
static java.lang.String |
SERIALIZER_CLASS_P
Name of the serializer class used to store resources. |
static java.lang.String |
SERVER_GROUP_P
UNIX - Name of the property that indicates the server group. |
static java.lang.String |
SERVER_SOFTWARE_P
Name of the server software property. |
static java.lang.String |
SERVER_USER_P
UNIX - Name of the property that indicates the server user. |
static java.lang.String |
SHUFFLER_PATH_P
Name of the property giving the shuffler path. |
static java.lang.String |
SPACE_P
Name of the property giving the server space directory. |
static java.lang.String |
STARTUP_P
Name of the property indicating the startup classes to load |
static int |
STORE_SIZE_LIMIT
|
static java.lang.String |
STORE_SIZE_LIMIT_P
Max number of store loaded in memory. |
java.lang.Thread |
thread
|
EventManager |
timer
|
static java.lang.String |
TRACE_P
Name of the server's trace property. |
static java.lang.String |
TRASHDIR_P
Name of the property indicating the trash directory. |
protected java.net.URL |
url
FIXME check for clones This server URL. |
static java.lang.String |
USE_SM_P
Name of property that indicates if some security manager is required. |
static int |
verscount
The current internal version counter of Jigsaw. |
static java.lang.String |
VERSCOUNT_P
|
static java.lang.String |
version
The current displayed version of Jigsaw. |
Constructor Summary | |
---|---|
httpd()
Create a new server instance in this process. |
Method Summary | |
---|---|
boolean |
checkFileSystemSensitivity()
Is the underlying file-system case sensitive ? |
void |
checkpoint()
Checkpoint all cached data, by saving them to disk. |
protected boolean |
checkUpgrade(java.lang.String id,
ObservableProperties props)
|
protected void |
cleanTempDirectory()
Clean the temp dir. |
protected void |
cleanup(boolean restart)
Cleanup the resources associated with this server context. |
ServerHandler |
clone(ServerHandlerManager shm,
java.lang.String id,
ObservableProperties props)
clone this server |
void |
debug(boolean onoff)
Turn debugging on/off for this instance of httpd server. |
java.util.Enumeration |
enumeratePropertySet()
Enumerate all the registered property sets |
void |
errlog(Client client,
java.lang.String msg)
Emit a server error on behalf of some client object. |
void |
errlog(java.lang.Object from,
java.lang.String msg)
The prefered form for reporting errors. |
void |
errlog(Resource from,
java.lang.String msg)
Another nice way of reporting errors from an HTTPResource. |
void |
errlog(java.lang.String msg)
Emit an error on behalf of the server. |
void |
fatal(java.lang.Exception e,
java.lang.String msg)
Emit a fatal error. |
void |
fatal(java.lang.String msg)
Emit a fatal error. |
java.io.File |
getAuthDirectory()
Get this server authentication directory. |
protected java.lang.String |
getBanner()
|
int |
getClientBufferSize()
Get the client's buffer size. |
boolean |
getClientDebug()
Get the client's debug flags from the properties. |
boolean |
getClientKeepConnection()
Does this server wants clients to try keeping connections alive ? |
int |
getClientThreadPriority()
Get the client's threads priority from the properties. |
java.io.File |
getConfigDirectory()
Get this server config directory. |
ResourceReference |
getConfigResource()
get this server config resource |
int |
getConnectionTimeOut()
Get the connection allowed idle time from the properties. |
ResourceContext |
getDefaultContext()
Get the default resource context for that server. |
java.lang.String |
getDocumentationURL()
Get the full URL of Jigsaw's documentation. |
ResourceReference |
getEditRoot()
Get the server's edit root resource. |
java.lang.String |
getHost()
Get this server host name. |
java.lang.String |
getHTMLStatus()
Give the status of this class as a partial HTML text which will be added into a block level element |
java.lang.String |
getIdentifier()
Get this server identifier. |
java.io.File |
getIndexerDirectory()
Get this server index directory |
IndexersCatalog |
getIndexersCatalog()
get the indexer catalog of this server |
java.net.InetAddress |
getInetAddress()
Get the server inet address |
int |
getLocalPort()
Get the server local port |
Logger |
getLogger()
Get the logger for that server. |
protected MimeParserFactory |
getMimeClientFactory(Client client)
|
int |
getPort()
Get this server port number. |
ObservableProperties |
getProperties()
Get this server properties. |
Resource |
getPropertySet(java.lang.String name)
Get a property set matching a specific name |
RealmsCatalog |
getRealmsCatalog()
Get this server realm catalog. |
int |
getRequestTimeOut()
Get the request allowed time slice from the properties. |
ResourceSpace |
getResourceSpace()
Get this server resource space |
ResourceStoreManager |
getResourceStoreManager()
Get this server resourcestore manager. |
FramedResource |
getRoot()
Get the server current root resource. |
java.io.File |
getRootDirectory()
Get this server root directory. |
ResourceReference |
getRootReference()
get the resource reference of the root resource of the server |
Shuffler |
getShuffler(Client client)
Get a shuffler for this server's client. |
java.lang.String |
getSoftware()
Get the server software string. |
java.io.File |
getSpaceDir()
Get this server space diretory |
httpdStatistics |
getStatistics()
Get this server statistics. |
java.io.File |
getStoreDirectory()
Get this server store directory. |
java.io.File |
getTempDirectory()
Get temp directory |
java.lang.String |
getTrashDirectory()
Get the tracsh directory |
java.net.URL |
getURL()
Get the server URL. |
void |
initialize(ServerHandlerManager shm,
java.lang.String identifier,
ObservableProperties props)
Initialize a new HTTP server. |
protected void |
initializeProperties()
FIXME protected for now to handle clones Initialize some of the servers instance values from properties. |
protected void |
initializePropertySets()
|
boolean |
isLenient()
Get the lenient value, tru if we are lenient in HTTP parsing |
ResourceReference |
loadResource(java.lang.String name)
Lookup the root store for some resource. |
ResourceReference |
loadRoot(java.lang.String name)
Dynamically change the root resource for the server. |
protected void |
loadStartupClasses()
startup classes |
void |
log(Client client,
Request request,
Reply reply,
int nbytes,
long duration)
Emit a log entry. |
void |
log(java.lang.String msg)
Emit a log message. |
static void |
main(java.lang.String[] args)
debugging main |
ReplyInterface |
perform(RequestInterface req)
Perform the given request on behalf of this server. |
boolean |
propertyChanged(java.lang.String name)
The property monitoring implementation. |
void |
registerPropertySet(PropertySet set)
Register a property set to the server. |
void |
restart()
Restart the server properly. |
void |
run()
|
void |
shutdown()
Shutdown the server properly. |
void |
start()
start the server it will than startup, and finally run in its own thread. |
void |
startCheckpoint()
start the automatic checkpoint |
void |
trace(Client client,
java.lang.String msg)
Emit a server trace. |
void |
trace(java.lang.String msg)
Emit a server trace, on behalf of the server itself. |
static void |
usage()
this server's usage |
void |
warning(java.lang.Exception e,
java.lang.String msg)
Emit a warning. |
void |
warning(java.lang.String msg)
Emit a warning. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String version
public static final int verscount
public static final boolean debug
public static final java.lang.String VERSCOUNT_P
public static final java.lang.String SERVER_SOFTWARE_P
This property defaults to Jigsaw/1.0a.
public static final java.lang.String DEFHOSTIP_P
public static final java.lang.String HOST_P
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).
public static final java.lang.String ROOT_P
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.
public static final java.lang.String CONFIG_P
public static final java.lang.String SPACE_P
This property defaults to
public static final java.lang.String PORT_P
This property defaults to 8888
.
public static final java.lang.String TRACE_P
This property defaults to false.
public static final java.lang.String KEEP_ALIVE_P
This property defaults to true.
public static final java.lang.String KEEP_TIMEOUT_P
This property defaults to 10000
milliseconds.
public static final java.lang.String REQUEST_TIMEOUT_P
This property defaults to 60000
.
public static final java.lang.String CLIENT_PRIORITY_P
This property defaults to Thread.NORM_PRIORITY
.
public static final java.lang.String CLIENT_BUFSIZE_P
This property defaults to 8192
.
public static final java.lang.String CLIENT_DEBUG_P
This property defaults to false.
public static final java.lang.String USE_SM_P
This property defaults to
public static final java.lang.String LOGGER_P
org.w3c.jigsaw.core.CommonLogger
, which implements the
common log format.
Property defaults to org.w3c.jigsaw.core.CommonLogger
public static final java.lang.String LENIENT_P
Property defaults to true
public static final java.lang.String CLIENT_FACTORY_P
public static final java.lang.String SHUFFLER_PATH_P
This should be an absloute path.
This property has no defaults.
public static final java.lang.String ROOT_NAME_P
This property defaults to root
.
public static final java.lang.String ROOT_CLASS_P
public static final java.lang.String MAX_LOADED_STORE_P
public static final int MAX_LOADED_STORE
public static final java.lang.String STORE_SIZE_LIMIT_P
public static final int STORE_SIZE_LIMIT
public static final java.lang.String PROPS_P
This property defaults to config/httpd.props
.
public static final java.lang.String FS_SENSITIVITY
For obvious security reasons, this property defaults to true.
public static java.lang.String DOCURL_P
public static java.lang.String STARTUP_P
public static java.lang.String TRASHDIR_P
public static java.lang.String CHECKURL_P
public static java.lang.String PUBLIC_P
|
separated list of
methods available on that server.
This property defaults to: GET | HEAD | PUT | POST
| OPTIONS | DELETE | LINK | UNLINK | TRACE.
public static java.lang.String EDIT_ROOT_P
public static java.lang.String SERIALIZER_CLASS_P
public static java.lang.String SERVER_USER_P
This property has no default value.
public static java.lang.String SERVER_GROUP_P
This property has no default value.
public static java.lang.String DISPLAY_URL_ON_ERROR_P
public java.lang.Thread thread
public EventManager timer
protected int[] instances
protected ObservableProperties props
protected java.lang.String host
protected int port
public FramedResource root
protected java.net.URL url
Constructor Detail |
---|
public httpd()
identifier
- The server's identifier.props
- The server properties.Method Detail |
---|
public boolean propertyChanged(java.lang.String name)
propertyChanged
in interface PropertyMonitoring
name
- The name of the property that has changed.
public ResourceReference loadResource(java.lang.String name)
loadResource
in interface ServerInterface
name
- The name of the resource to lookup in the root store.
public void startCheckpoint()
public void checkpoint()
checkpoint
in interface ServerInterface
public ResourceReference loadRoot(java.lang.String name)
loadRoot
in interface ServerInterface
name
- The name of the new root resource, to be found in the
root resource store.
protected MimeParserFactory getMimeClientFactory(Client client)
protected void loadStartupClasses()
protected void initializeProperties() throws ServerHandlerInitException
ServerHandlerInitException
- if unable to be initialized.public void registerPropertySet(PropertySet set)
propSet
- The property set to register.public java.util.Enumeration enumeratePropertySet()
public Resource getPropertySet(java.lang.String name)
protected void initializePropertySets()
public httpdStatistics getStatistics()
public ObservableProperties getProperties()
getProperties
in interface ServerInterface
public boolean checkFileSystemSensitivity()
checkFileSystemSensitivity
in interface ServerInterface
public java.lang.String getDocumentationURL()
getDocumentationURL
in interface ServerInterface
public java.lang.String getTrashDirectory()
getTrashDirectory
in interface ServerInterface
public final boolean getClientDebug()
getClientDebug
in interface ServerInterface
public final boolean getClientKeepConnection()
getClientKeepConnection
in interface ServerInterface
public final int getRequestTimeOut()
getRequestTimeOut
in interface ServerInterface
public final int getConnectionTimeOut()
getConnectionTimeOut
in interface ServerInterface
public final int getClientThreadPriority()
getClientThreadPriority
in interface ServerInterface
public final int getClientBufferSize()
getClientBufferSize
in interface ServerInterface
public java.lang.String getHost()
getHost
in interface ServerInterface
public int getPort()
getPort
in interface ServerInterface
public FramedResource getRoot()
getRoot
in interface ServerInterface
public ResourceReference getRootReference()
public Logger getLogger()
public ResourceReference getEditRoot()
public java.net.URL getURL()
getURL
in interface ServerInterface
public java.lang.String getSoftware()
getSoftware
in interface ServerInterface
public int getLocalPort()
getLocalPort
in interface ServerInterface
public java.lang.String getIdentifier()
getIdentifier
in interface ServerHandler
public java.net.InetAddress getInetAddress()
getInetAddress
in interface ServerHandler
public java.io.File getRootDirectory()
getRootDirectory
in interface ServerInterface
public java.io.File getSpaceDir()
public java.io.File getConfigDirectory()
getConfigDirectory
in interface ServerInterface
public java.io.File getAuthDirectory()
getAuthDirectory
in interface ServerInterface
public java.io.File getStoreDirectory()
getStoreDirectory
in interface ServerInterface
public java.io.File getIndexerDirectory()
getIndexerDirectory
in interface ServerInterface
public java.io.File getTempDirectory()
getTempDirectory
in interface ServerInterface
protected void cleanTempDirectory()
public IndexersCatalog getIndexersCatalog()
getIndexersCatalog
in interface ServerInterface
public RealmsCatalog getRealmsCatalog()
public ResourceStoreManager getResourceStoreManager()
getResourceStoreManager
in interface ServerInterface
public ResourceSpace getResourceSpace()
getResourceSpace
in interface ServerInterface
public ResourceContext getDefaultContext()
getDefaultContext
in interface ServerInterface
public boolean isLenient()
protected void cleanup(boolean restart)
restart
- If true the server is restarted
(reinitialized) straight away.public void shutdown()
shutdown
in interface ServerHandler
cleanup(boolean)
public void restart()
reload_properties
- Should we reload the properties from the
property file, or should we just reinitialize from the current set
of properties.cleanup(boolean)
public void debug(boolean onoff)
A
- boolean, true turns debugging on, flase turns it off.public void trace(Client client, java.lang.String msg)
client
- The client object which wants to report the trace.msg
- The trace message.log(org.w3c.jigsaw.http.Client, org.w3c.jigsaw.http.Request, org.w3c.jigsaw.http.Reply, int, long)
public void trace(java.lang.String msg)
trace
in interface ServerHandler
msg
- The trace the server wants to emit.public void log(Client client, Request request, Reply reply, int nbytes, long duration)
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.public void log(java.lang.String msg)
log
in interface ServerHandler
msg
- The message to log.public void errlog(Client client, java.lang.String msg)
client
- The client.msg
- The error message.public void errlog(java.lang.String msg)
errlog
in interface ServerHandler
msg
- The error message.public void errlog(java.lang.Object from, java.lang.String msg)
from
- The object that emited the error.msg
- The error message.public void errlog(Resource from, java.lang.String msg)
errlog
in interface ServerInterface
from
- The resource that trigered the error.msg
- The error message.public void fatal(java.lang.Exception e, java.lang.String msg)
e
- Any exception that caused the error.msg
- Any additional message.public void fatal(java.lang.String msg)
msg
- Any error messagepublic void warning(java.lang.String msg)
msg
- The warning message.public void warning(java.lang.Exception e, java.lang.String msg)
e
- Any exception.msg
- Any message.public Shuffler getShuffler(Client client)
Shuffler
protected java.lang.String getBanner()
public void run()
run
in interface java.lang.Runnable
public ReplyInterface perform(RequestInterface req) throws ProtocolException, ResourceException
perform
in interface ServerInterface
request
- The request to perform.
ProtocolException
- If some error occurs during processing the
request.
ResourceException
- If a resource got a fatal error.protected boolean checkUpgrade(java.lang.String id, ObservableProperties props)
public void initialize(ServerHandlerManager shm, java.lang.String identifier, ObservableProperties props) throws ServerHandlerInitException
initialize
in interface ServerHandler
identifier
- The string identifying this server's occurence.props
- A set of properties to initialize from.shm
- The global server handler manager.
ServerHandlerInitException
- if unable to be initialized.public void start() throws ServerHandlerInitException
start
in interface ServerHandler
ServerHandlerInitException
- if initialization failed.public ServerHandler clone(ServerHandlerManager shm, java.lang.String id, ObservableProperties props) throws ServerHandlerInitException
clone
in interface ServerHandler
shm
- The global server handler manager.id
- The new ServerHandler identifier.props
- The properties that overide part of the configuration of
the cloned server.
ServerHandlerInitException
- if unable to be initialized.public ResourceReference getConfigResource()
getConfigResource
in interface ServerHandler
public java.lang.String getHTMLStatus()
getHTMLStatus
in interface Status
public static void usage()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |