|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.opencyc.webserver.WebServer
Inner Class Summary | |
protected class |
WebServer.Task
Class Task processes a single HTTP request. |
Field Summary | |
protected static int |
CACHE_CAPACITY
File cache capacity. |
static WebServer |
current
Singleton WebServer instance. |
protected java.lang.String |
cycHost
Cyc HTML host. |
protected int |
cycPort
Cyc HTML port. |
protected static int |
DEFAULT_CYC_PORT
Default Cyc base port. |
protected static java.lang.String |
DEFAULT_DIR
Default directory to serve files from on non-Windows OS. |
protected static int |
DEFAULT_PORT
Default HTTP port. |
protected static java.lang.String |
DEFAULT_WIN_DIR
Default directory to serve files from on Windows. |
protected java.util.ArrayList |
dirs
Directories to serve files from. |
protected static java.util.Hashtable |
fileCache
File cache to improve file serving performance. |
protected java.util.HashMap |
map
Map from String (jar root) to JarFile[] (jar class path). |
protected static long |
nbrCacheHits
Number of files served from this web server that were found in the cache. |
protected static long |
nbrFilesServed
Number of files served from this web server. |
protected int |
port
Webserver HTTP port. |
protected java.net.ServerSocket |
server
Server socket for accepting connections. |
protected boolean |
traceRequests
Requests flag. |
protected boolean |
trees
Expand jar tress. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
WebServer()
Constructs a WebServer object. |
Method Summary | |
void |
clearFileCache()
Administrative method that clears the file cache. |
java.util.ArrayList |
getDirs()
Administrative accessor method that obtains list of directories from which files are served. |
long |
getNbrCacheHits()
Administrative accessor method that obtains number of files served from cache. |
long |
getNbrFilesServed()
Administrative accessor method that obtains number of files served. |
static void |
main(java.lang.String[] args)
Provides the command line interface for creating an HTTP server. |
void |
run()
Just keep looping, spawning a new thread for each incoming request. |
void |
setDirs(java.util.ArrayList dirs)
Administrative method that updates the list of directories from which files are served. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static WebServer current
protected static int DEFAULT_PORT
protected static int DEFAULT_CYC_PORT
protected static java.lang.String DEFAULT_DIR
protected static java.lang.String DEFAULT_WIN_DIR
protected static final int CACHE_CAPACITY
protected static java.util.Hashtable fileCache
protected static long nbrFilesServed
protected static long nbrCacheHits
protected java.net.ServerSocket server
protected java.util.ArrayList dirs
protected java.util.HashMap map
protected int port
protected java.lang.String cycHost
protected int cycPort
protected boolean trees
protected boolean traceRequests
Constructor Detail |
public WebServer() throws java.io.IOException
port
- the port to usedirectories
- the directory to serve files fromtrees
- true if files within jar files should be served uptraceRequests
- true if client's request text should be logged.java.io.IOException
- if the listening socket cannot be opened, or problem opening jar files.Method Detail |
public java.util.ArrayList getDirs()
public void setDirs(java.util.ArrayList dirs) throws java.io.IOException
public long getNbrFilesServed()
public long getNbrCacheHits()
public void clearFileCache()
public static void main(java.lang.String[] args)
org.opencyc.webserver.port=which defaults to 80.
org.opencyc.webserver.cycPort=which defaults to 3600.
org.opencyc.webserver.dirs=with the argument enclosed in quotes if any path contains an embedded space. The default directory on Windows is C: and the default on other systems is / the default can be overridden with this property. By default, all files under this directory (including all subdirectories) are served up via HTTP. If the pathname of a file is path relative to the top-level directory, then the file can be downloaded using the URL; ... ;
http://host:port/pathCaching of file contents is performed.
org.opencyc.util.log=allIf the all value is given, then all attempts to download files are output.
org.opencyc.webserver.traceRequestsIf this property has any value, then the client HTTP requests are output.
org.opencyc.webserver.treesThis property can be used to serve up individual files stored within jar files in addition to the files that are served up by default. If the property has any value, the server finds all jar files in the top-level directory (not in subdirectories). For each jar file, if the name of the jar file is name.jar, then any individual file named file within that jar file (or within the jar or zip files referenced transitively in the Class-Path manifest attribute, can be downloaded using a URL of the form:
http://host:port/name/fileWhen this property has any value, an open file descriptor and cached information are held for each jar file, for the life of the process.
args
- an unused array of command line arguments.public void run()
run
in class java.lang.Thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |