public class HttpWebServer extends Object implements WebServerInterface
The first character the HTTP request string is passed to the
onClientRequest
routine. The rest of the string is read from
the socket.
Constructor and Description |
---|
HttpWebServer()
The constructor does not take any parameters and is not currently
needed.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCaches()
Clears the web server caches.
|
MessageDigest |
createMessageDigest()
Gets a new instance of the message digest class.
|
void |
displayWebServerCache(VirtualCListBox list)
Fills a list box with the cache information.
|
void |
dispose()
Disposes of the Web Server (to stops it).
|
static boolean |
doLogHTTPRequests()
Checks for logging of HTTP requests.
|
void |
finishedProcessingRequest()
Call this method when a request has been processed.
|
int |
getBlockSize()
Gets the block size for data to clients.
|
Object |
getCgiInstance(String name)
Gets a new instance of a CGI class.
|
ClientSessionManager |
getClientSessionManager()
Gets the client session manager.
|
String |
getDefaultDocument(String uri)
Checks if the URI points to a directory from the document root.
|
String |
getDocumentRoot()
Gets the document root.
|
static String |
getHostAddress()
Gets the host address (or null if default one is used).
|
static String |
getHostName()
Gets the host name (or null if default or raw IP is used).
|
int |
getMaximumResourceSize()
Gets the maximum size for a resource before it is
sent as blocks of data directly from file rather than
from cache.
|
int |
getMaximumWebServerRequests()
Gets the current count of outstanding web server requests.
|
MimeTypes |
getMimeTypes()
Gets the mime type class instance.
|
HttpReply |
getReply()
Gets the HTTP Reply helper.
|
HttpResourceDefinition |
getResourceDefinition(String name)
Finds a resource definition that matches this request.
|
int |
getWebServerRequests()
Gets the current count of outstanding web server requests.
|
void |
initialize(ClientSessionManager csm)
This method is called just after creation of the web server interface.
|
boolean |
isFileSystemCaseSensitive()
Check if the file system for root and error documents is case sensitive.
|
boolean |
isProcessingRequestAllowed()
Call this method when a request is about to be processed.
|
static boolean |
isRawIPUsed()
Checks if the web server should use raw IP addresses instead of DNS name.
|
HtmlResource |
loadAbsoluteDocument(HttpResourceParameters httpParams)
Loads a HTML resource from a specific directory.
|
HtmlResource |
loadAbsoluteDocument(String fileName)
Loads a HTML resource from a specific directory.
|
HtmlResource |
loadAbsoluteDocument(String fileName,
boolean isFromRoot)
Loads a HTML resource from a specific directory.
|
HtmlResource |
loadErrorDocument(String name)
Loads a HTML resource from the 'documentError' directory.
|
HttpResource |
loadResource(HttpResourceParameters httpParams,
boolean isAbsolute)
Loads a resource.
|
HttpResource |
loadResource(String name,
String fileName,
boolean isAbsolute)
Loads a resource.
|
void |
onClientRequest(ServerSocketInterface ssi,
ISocket socket,
int firstChar,
String id)
This method is called whenever a web server request is called
from a client.
|
void |
outOfMemoryRecover()
Recovers after out of memory by clearing caches and performing
a garbage collection.
|
static void |
setLogHTTPRequests(boolean doLog)
Sets logging of HTTP requests.
|
public HttpWebServer()
public boolean isProcessingRequestAllowed()
public void finishedProcessingRequest()
public static boolean doLogHTTPRequests()
public static void setLogHTTPRequests(boolean doLog)
public static boolean isRawIPUsed()
public static String getHostAddress()
public static String getHostName()
public int getWebServerRequests()
public int getMaximumWebServerRequests()
public void initialize(ClientSessionManager csm) throws IOException
The web server loads the definitions of:
- The document information of the Web Server
- Creates the caches and the resource manager
- Loads the mimetypes
- The NetPhantom Applications
- The CGI definitions.
initialize
in interface WebServerInterface
IOException
- if there is a problem in loading the web server.public void dispose()
dispose
in interface WebServerInterface
public Object getCgiInstance(String name)
The interface implemented by the class is either
CgiPrintInterface
, CgiHttpResourceInterface
or CgiHtmlResourceInterface
in case of a normal CGI.
For HTML-included CGIs, the class must implement
IncludeCgiPrintInterface
or
IncludeCgiHtmlResourceInterface
.
Include-type CGIs are defined by the ID "<classid>" whereas normal CGIs are defined just by "classid".
CgiPrintInterface
,
CgiHttpResourceInterface
,
CgiHtmlResourceInterface
,
IncludeCgiPrintInterface
,
IncludeCgiHtmlResourceInterface
public String getDocumentRoot()
public String getDefaultDocument(String uri)
public void onClientRequest(ServerSocketInterface ssi, ISocket socket, int firstChar, String id) throws IOException
onClientRequest
in interface WebServerInterface
IOException
- if there is a problem in requesting the data
from the server.public boolean isFileSystemCaseSensitive()
public MimeTypes getMimeTypes()
public ClientSessionManager getClientSessionManager()
public HttpReply getReply()
public HttpResource loadResource(String name, String fileName, boolean isAbsolute) throws IOException
IOException
- for read resource failures.public HttpResource loadResource(HttpResourceParameters httpParams, boolean isAbsolute) throws IOException
IOException
- for read resource failures.public HtmlResource loadErrorDocument(String name) throws IOException
IOException
public HtmlResource loadAbsoluteDocument(String fileName) throws IOException
IOException
public HtmlResource loadAbsoluteDocument(String fileName, boolean isFromRoot) throws IOException
IOException
public HtmlResource loadAbsoluteDocument(HttpResourceParameters httpParams) throws IOException
IOException
public HttpResourceDefinition getResourceDefinition(String name) throws IOException
IOException
- for resource definition failures.public MessageDigest createMessageDigest()
public void displayWebServerCache(VirtualCListBox list)
public void clearCaches()
public void outOfMemoryRecover()
public int getBlockSize()
public int getMaximumResourceSize()
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.