Node Director
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
sfi.director.util.NanoHTTPD Class Reference

derived from Jarno Elonen's NanoHTTPD class. More...

Inheritance diagram for sfi.director.util.NanoHTTPD:
fi.iki.elonen.NanoHTTPD sfi.director.application.FrontendHTTPServer

Public Member Functions

 NanoHTTPD (int port) throws IOException
 Starts a HTTP server to given port.
Response serveFile (String uri, Properties header, File dir, boolean allowListing)
Response serveFile (String uri, Map< String, String > header, File dir, boolean allowListing)
- Public Member Functions inherited from fi.iki.elonen.NanoHTTPD
 NanoHTTPD (String hostname, int port)
 Constructs an HTTP server on given hostname and port.
synchronized void closeAllConnections ()
 Forcibly closes all connections that are open.
final int getListeningPort ()
final boolean isAlive ()
void makeSecure (SSLServerSocketFactory sslServerSocketFactory)
 Call before start() to serve over HTTPS instead of HTTP.
Response newChunkedResponse (IStatus status, String mimeType, InputStream data)
 Create a response with unknown length (using HTTP 1.1 chunking).
Response newFixedLengthResponse (IStatus status, String mimeType, InputStream data, long totalBytes)
 Create a response with known length.
Response newFixedLengthResponse (IStatus status, String mimeType, String txt)
 Create a text response with known length.
Response newFixedLengthResponse (String msg)
 Create a text response with known length.
Response serve (IHTTPSession session)
 Override this to customize the server.
Response serve (String uri, Method method, Map< String, String > headers, Map< String, String > parms, Map< String, String > files)
 Override this to customize the server.
void setAsyncRunner (AsyncRunner asyncRunner)
 Pluggable strategy for asynchronously executing requests.
void setTempFileManagerFactory (TempFileManagerFactory tempFileManagerFactory)
 Pluggable strategy for creating and cleaning up temporary files.
void start () throws IOException
 Start the server.
void start (final int timeout) throws IOException
 Start the server.
void stop ()
 Stop the server.
final boolean wasStarted ()

Static Public Member Functions

static String readLine (InputStream is) throws IOException
- Static Public Member Functions inherited from fi.iki.elonen.NanoHTTPD
static SSLServerSocketFactory makeSSLSocketFactory (KeyStore loadedKeyStore, KeyManager[] keyManagers) throws IOException
 Creates an SSLSocketFactory for HTTPS.
static SSLServerSocketFactory makeSSLSocketFactory (KeyStore loadedKeyStore, KeyManagerFactory loadedKeyFactory) throws IOException
 Creates an SSLSocketFactory for HTTPS.
static SSLServerSocketFactory makeSSLSocketFactory (String keyAndTrustStoreClasspathPath, char[] passphrase) throws IOException
 Creates an SSLSocketFactory for HTTPS.

Static Public Attributes

static final String MIME_PLAINTEXT = "text/plain"
 Common mime types for dynamic content.
- Static Public Attributes inherited from fi.iki.elonen.NanoHTTPD
static final int SOCKET_READ_TIMEOUT = 5000
 Maximum time to wait on Socket.getInputStream().read() (in milliseconds) This is required as the Keep-Alive HTTP connections would otherwise block the socket reading thread forever (or as long the browser is open).
static final String MIME_PLAINTEXT = "text/plain"
 Common MIME type for dynamic content: plain text.
static final String MIME_HTML = "text/html"
 Common MIME type for dynamic content: html.

Additional Inherited Members

- Protected Member Functions inherited from fi.iki.elonen.NanoHTTPD
ClientHandler createClientHandler (final Socket finalAccept, final InputStream inputStream)
 create a instance of the client handler, subclasses can return a subclass of the ClientHandler.
ServerRunnable createServerRunnable (final int timeout)
 Instantiate the server runnable, can be overwritten by subclasses to provide a subclass of the ServerRunnable.
Map< String, List< String > > decodeParameters (Map< String, String > parms)
 Decode parameters from a URL, handing the case where a single parameter name might have been supplied several times, by return lists of values.
Map< String, List< String > > decodeParameters (String queryString)
 Decode parameters from a URL, handing the case where a single parameter name might have been supplied several times, by return lists of values.
String decodePercent (String str)
 Decode percent encoded String values.
boolean useGzipWhenAccepted ()
- Protected Attributes inherited from fi.iki.elonen.NanoHTTPD
AsyncRunner asyncRunner
 Pluggable strategy for asynchronously executing requests.

Detailed Description

derived from Jarno Elonen's NanoHTTPD class.

See below. Of course, any bugs are due to my modifications. Tom.

Constructor & Destructor Documentation

sfi.director.util.NanoHTTPD.NanoHTTPD ( int  port) throws IOException

Starts a HTTP server to given port.

Throws an IOException if the socket is already in use

Reimplemented from fi.iki.elonen.NanoHTTPD.

Member Function Documentation

static String sfi.director.util.NanoHTTPD.readLine ( InputStream  is) throws IOException
static
Response sfi.director.util.NanoHTTPD.serveFile ( String  uri,
Properties  header,
File  dir,
boolean  allowListing 
)
Response sfi.director.util.NanoHTTPD.serveFile ( String  uri,
Map< String, String >  header,
File  dir,
boolean  allowListing 
)

Member Data Documentation

final String sfi.director.util.NanoHTTPD.MIME_PLAINTEXT = "text/plain"
static

The documentation for this class was generated from the following file: