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) |
| 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 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.
|
Additional Inherited Members |
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 () |
AsyncRunner | asyncRunner |
| Pluggable strategy for asynchronously executing requests.
|
derived from Jarno Elonen's NanoHTTPD class.
See below. Of course, any bugs are due to my modifications. Tom.