public class SimpleWebServer extends NanoHTTPD
NanoHTTPD.AsyncRunner, NanoHTTPD.ClientHandler, NanoHTTPD.Cookie, NanoHTTPD.CookieHandler, NanoHTTPD.DefaultAsyncRunner, NanoHTTPD.DefaultServerSocketFactory, NanoHTTPD.DefaultTempFile, NanoHTTPD.DefaultTempFileManager, NanoHTTPD.HTTPSession, NanoHTTPD.IHTTPSession, NanoHTTPD.Method, NanoHTTPD.Response, NanoHTTPD.ResponseException, NanoHTTPD.SecureServerSocketFactory, NanoHTTPD.ServerRunnable, NanoHTTPD.ServerSocketFactory, NanoHTTPD.TempFile, NanoHTTPD.TempFileManager, NanoHTTPD.TempFileManagerFactory| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_CONTROL_ALLOW_HEADER_PROPERTY_NAME |
static List<String> |
INDEX_FILE_NAMES
Default Index file names.
|
protected List<File> |
rootDirs |
asyncRunner, MIME_HTML, MIME_PLAINTEXT, MIME_TYPES, SOCKET_READ_TIMEOUT| Constructor and Description |
|---|
SimpleWebServer(String host,
int port,
File wwwroot,
boolean quiet) |
SimpleWebServer(String host,
int port,
File wwwroot,
boolean quiet,
String cors) |
SimpleWebServer(String host,
int port,
List<File> wwwroots,
boolean quiet) |
SimpleWebServer(String host,
int port,
List<File> wwwroots,
boolean quiet,
String cors) |
| Modifier and Type | Method and Description |
|---|---|
protected NanoHTTPD.Response |
addCORSHeaders(Map<String,String> queryHeaders,
NanoHTTPD.Response resp,
String cors) |
protected NanoHTTPD.Response |
getForbiddenResponse(String s) |
protected NanoHTTPD.Response |
getInternalErrorResponse(String s) |
protected NanoHTTPD.Response |
getNotFoundResponse() |
void |
init()
Used to initialize and customize the server.
|
protected String |
listDirectory(String uri,
File f) |
static void |
main(String[] args)
Starts as a standalone file server and waits for Enter.
|
static NanoHTTPD.Response |
newFixedLengthResponse(NanoHTTPD.Response.IStatus status,
String mimeType,
String message) |
protected static void |
registerPluginForMimeType(String[] indexFiles,
String mimeType,
WebServerPlugin plugin,
Map<String,String> commandLineOptions) |
NanoHTTPD.Response |
serve(NanoHTTPD.IHTTPSession session) |
closeAllConnections, createClientHandler, createServerRunnable, decodeParameters, decodeParameters, decodePercent, getHostname, getListeningPort, getMimeTypeForFile, getServerSocketFactory, getTempFileManagerFactory, isAlive, makeSecure, makeSSLSocketFactory, makeSSLSocketFactory, makeSSLSocketFactory, mimeTypes, newChunkedResponse, newFixedLengthResponse, newFixedLengthResponse, serve, setAsyncRunner, setServerSocketFactory, setTempFileManagerFactory, start, start, start, stop, useGzipWhenAccepted, wasStartedpublic static final String ACCESS_CONTROL_ALLOW_HEADER_PROPERTY_NAME
public SimpleWebServer(String host, int port, File wwwroot, boolean quiet, String cors)
public static void main(String[] args)
protected static void registerPluginForMimeType(String[] indexFiles, String mimeType, WebServerPlugin plugin, Map<String,String> commandLineOptions)
protected NanoHTTPD.Response getForbiddenResponse(String s)
protected NanoHTTPD.Response getInternalErrorResponse(String s)
protected NanoHTTPD.Response getNotFoundResponse()
public void init()
public static NanoHTTPD.Response newFixedLengthResponse(NanoHTTPD.Response.IStatus status, String mimeType, String message)
public NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session)
protected NanoHTTPD.Response addCORSHeaders(Map<String,String> queryHeaders, NanoHTTPD.Response resp, String cors)
Copyright © 2012–2015 nanohttpd. All rights reserved.