Methods Summary |
---|
public void | close()Cause the thread accepting connections on the server socket to close
/* Stop the Accept thread */
if (acceptT != null) {
log("Closing AcceptThread"+acceptT);
acceptT.close();
acceptT = null;
}
|
public void | initServer(boolean log)Initialize a new server with default port and timeout.
initServer(DEFAULT_PORT, DEFAULT_TIMEOUT, log);
|
public void | initServer(int port, boolean log)Initialize a new server with default timeout.
initServer(port, DEFAULT_TIMEOUT, log);
|
public void | initServer(int port, java.lang.String servePath, java.lang.String contentType)Initialize a new server with default timeout and disabled log.
Support_TestWebData.initDynamicTestWebData(servePath, contentType);
initServer(port, DEFAULT_TIMEOUT, false);
|
public void | initServer(int port, int timeout, boolean log)Initialize a new server with default port and timeout.
mPort = port;
mTimeout = timeout;
mLog = log;
keepAlive = true;
if (acceptT == null) {
acceptT = new AcceptThread();
acceptT.init();
acceptT.start();
}
|
protected void | log(java.lang.String s)Print to the log file (if logging enabled)
if (mLog) {
Logger.global.fine(s);
}
|
public void | setAcceptLimit(int limit)Call this to specify the maximum number of sockets to accept
acceptLimit = limit;
|
public void | setChunked(boolean value)Call this to indicate whether chunked data should be used
chunked = value;
|
public void | setHttpVersion11(boolean set)Set the server to be an HTTP/1.0 or HTTP/1.1 server.
This should be called prior to any requests being sent
to the server.
http11 = set;
if (set) {
HTTP_VERSION_STRING = "HTTP/1.1";
} else {
HTTP_VERSION_STRING = "HTTP/1.0";
}
|
public void | setKeepAlive(boolean value)Call this to determine whether server connection should remain open
keepAlive = value;
|
public void | setRedirect(java.lang.String redirect, int code)Call this to indicate redirection port requirement.
When this value is set, the server will respond to a request with
a redirect code with the Location response header set to the value
specified.
redirectHost = redirect;
redirectCode = code;
log("Server will redirect output to "+redirect+" code "+code);
|