public class FileNanoHTTPD extends NanoHTTPD implements FileHTTPD
NanoHTTPD.AsyncRunner, NanoHTTPD.ClientHandler, NanoHTTPD.Cookie, NanoHTTPD.CookieHandler, NanoHTTPD.DefaultAsyncRunner, NanoHTTPD.DefaultServerSocketFactory, NanoHTTPD.DefaultTempFile, NanoHTTPD.DefaultTempFileManager, NanoHTTPD.DefaultTempFileManagerFactory, 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 |
---|---|
Map<CharSequence,Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response>> |
getHandlers
The Custom getHandlers.
|
protected ExecutorService |
pool
The Pool.
|
Map<CharSequence,Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response>> |
postHandlers
The Post handlers.
|
asyncRunner, BOUNDARY_PATTERN, BOUNDARY_REGEX, CHARSET_PATTERN, CHARSET_REGEX, CONTENT_DISPOSITION_ATTRIBUTE_PATTERN, CONTENT_DISPOSITION_ATTRIBUTE_REGEX, CONTENT_DISPOSITION_PATTERN, CONTENT_DISPOSITION_REGEX, CONTENT_TYPE_PATTERN, CONTENT_TYPE_REGEX, hostname, LOG, MIME_HTML, MIME_PLAINTEXT, MIME_TYPES, myPort, myServerSocket, myThread, QUERY_STRING_PARAMETER, serverSocketFactory, SOCKET_READ_TIMEOUT, tempFileManagerFactory
Constructor and Description |
---|
FileNanoHTTPD(File root,
int port)
Instantiates a new File nano httpd.
|
Modifier and Type | Method and Description |
---|---|
Closeable |
addGET(CharSequence path,
Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> value)
Add session handler function.
|
Closeable |
addGET(CharSequence path,
String mimeType,
Consumer<OutputStream> logic)
Add sync handler.
|
Closeable |
addPOST(CharSequence path,
Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> value)
Add post closeable.
|
static FileNanoHTTPD |
create(int port,
File path,
String mimeType)
Create output stream.
|
static Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> |
handler(String mimeType,
Consumer<OutputStream> logic)
Sync handler function.
|
FileNanoHTTPD |
init()
Init stream nano httpd.
|
NanoHTTPD.Response |
serve(NanoHTTPD.IHTTPSession session) |
closeAllConnections, createClientHandler, createServerRunnable, decodeParameters, decodeParameters, decodePercent, getHostname, getListeningPort, getMimeTypeForFile, getServerSocketFactory, getTempFileManagerFactory, isAlive, loadMimeTypes, makeSecure, makeSSLSocketFactory, makeSSLSocketFactory, makeSSLSocketFactory, mimeTypes, newChunkedResponse, newFixedLengthResponse, newFixedLengthResponse, newFixedLengthResponse, safeClose, serve, setAsyncRunner, setServerSocketFactory, setTempFileManagerFactory, start, start, start, stop, useGzipWhenAccepted, wasStarted
public final Map<CharSequence,Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response>> getHandlers
public final Map<CharSequence,Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response>> postHandlers
protected final ExecutorService pool
public FileNanoHTTPD(File root, int port)
root
- the rootport
- the port@Nonnull public static FileNanoHTTPD create(int port, @Nonnull File path, String mimeType) throws IOException
port
- the portpath
- the pathmimeType
- the mime typeIOException
- the io exceptionpublic static Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> handler(String mimeType, @Nonnull Consumer<OutputStream> logic)
mimeType
- the mime typelogic
- the logicpublic Closeable addGET(CharSequence path, Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> value)
public Closeable addPOST(CharSequence path, Function<NanoHTTPD.IHTTPSession,NanoHTTPD.Response> value)
FileHTTPD
public Closeable addGET(CharSequence path, String mimeType, @Nonnull Consumer<OutputStream> logic)
@Nonnull public FileNanoHTTPD init() throws IOException
IOException
- the io exceptionpublic NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session)
Copyright © 2019 SimiaCryptus Software. All rights reserved.