Package fi.iki.elonen.router
Class RouterNanoHTTPD
- java.lang.Object
-
- fi.iki.elonen.NanoHTTPD
-
- fi.iki.elonen.router.RouterNanoHTTPD
-
public class RouterNanoHTTPD extends NanoHTTPD
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRouterNanoHTTPD.BaseRoutePrioritizerstatic classRouterNanoHTTPD.DefaultHandlerGeneral nanolet to inherit from if you provide text or html data, only fixed size responses will be generated.static classRouterNanoHTTPD.DefaultRoutePrioritizerstatic classRouterNanoHTTPD.DefaultStreamHandlerGeneral nanolet to inherit from if you provide stream data, only chucked responses will be generated.static classRouterNanoHTTPD.Error404UriHandlerHandling error 404 - unrecognized urlsstatic classRouterNanoHTTPD.GeneralHandlerGeneral nanolet to print debug info's as a html page.static classRouterNanoHTTPD.IndexHandlerHandling indexstatic classRouterNanoHTTPD.InsertionOrderRoutePrioritizerstatic interfaceRouterNanoHTTPD.IRoutePrioritizerstatic classRouterNanoHTTPD.NotImplementedHandlerstatic classRouterNanoHTTPD.ProvidedPriorityRoutePrioritizerstatic classRouterNanoHTTPD.StaticPageHandlerGeneral nanolet to print debug info's as a html page.static classRouterNanoHTTPD.UriResourcestatic interfaceRouterNanoHTTPD.UriResponderstatic classRouterNanoHTTPD.UriRouter-
Nested classes/interfaces inherited from class fi.iki.elonen.NanoHTTPD
NanoHTTPD.AsyncRunner, NanoHTTPD.ClientHandler, NanoHTTPD.ContentType, 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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.LoggerLOGlogger to log to.private RouterNanoHTTPD.UriRouterrouter-
Fields inherited from class fi.iki.elonen.NanoHTTPD
asyncRunner, MIME_HTML, MIME_PLAINTEXT, MIME_TYPES, SOCKET_READ_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description RouterNanoHTTPD(int port)RouterNanoHTTPD(java.lang.String hostname, int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMappings()default routings, they are over writable.voidaddRoute(java.lang.String url, java.lang.Class<?> handler, java.lang.Object... initParameter)static java.lang.StringnormalizeUri(java.lang.String value)voidremoveRoute(java.lang.String url)NanoHTTPD.Responseserve(NanoHTTPD.IHTTPSession session)Override this to customize the server.<T extends RouterNanoHTTPD.UriResponder>
voidsetNotFoundHandler(java.lang.Class<T> handler)<T extends RouterNanoHTTPD.UriResponder>
voidsetNotImplementedHandler(java.lang.Class<T> handler)voidsetRoutePrioritizer(RouterNanoHTTPD.IRoutePrioritizer routePrioritizer)-
Methods inherited from class fi.iki.elonen.NanoHTTPD
closeAllConnections, createClientHandler, createServerRunnable, decodeParameters, decodeParameters, decodePercent, getHostname, getListeningPort, getMimeTypeForFile, getServerSocketFactory, getTempFileManagerFactory, isAlive, makeSecure, makeSSLSocketFactory, makeSSLSocketFactory, makeSSLSocketFactory, mimeTypes, newChunkedResponse, newFixedLengthResponse, newFixedLengthResponse, newFixedLengthResponse, serve, setAsyncRunner, setServerSocketFactory, setTempFileManagerFactory, start, start, start, stop, useGzipWhenAccepted, wasStarted
-
-
-
-
Field Detail
-
LOG
private static final java.util.logging.Logger LOG
logger to log to.
-
router
private RouterNanoHTTPD.UriRouter router
-
-
Method Detail
-
normalizeUri
public static java.lang.String normalizeUri(java.lang.String value)
-
addMappings
public void addMappings()
default routings, they are over writable.router.setNotFoundHandler(GeneralHandler.class);
-
addRoute
public void addRoute(java.lang.String url, java.lang.Class<?> handler, java.lang.Object... initParameter)
-
setNotImplementedHandler
public <T extends RouterNanoHTTPD.UriResponder> void setNotImplementedHandler(java.lang.Class<T> handler)
-
setNotFoundHandler
public <T extends RouterNanoHTTPD.UriResponder> void setNotFoundHandler(java.lang.Class<T> handler)
-
removeRoute
public void removeRoute(java.lang.String url)
-
setRoutePrioritizer
public void setRoutePrioritizer(RouterNanoHTTPD.IRoutePrioritizer routePrioritizer)
-
serve
public NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session)
Description copied from class:NanoHTTPDOverride this to customize the server. (By default, this returns a 404 "Not Found" plain text error response.)
-
-