|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ebay.carad.os.vitalsigns.util.NanoHTTPD
public class NanoHTTPD
A simple, tiny, nicely embeddable HTTP 1.0 server in Java
NanoHTTPD version 1.1, Copyright © 2001,2005-2007 Jarno Elonen (elonen@iki.fi, http://iki.fi/elonen/)
Features + limitations:
Ways to use:
Nested Class Summary | |
---|---|
private class |
NanoHTTPD.HTTPSession
Handles one session, i.e. |
class |
NanoHTTPD.Response
HTTP response. |
Field Summary | |
---|---|
private static java.text.SimpleDateFormat |
gmtFrmt
GMT date formatter |
static java.lang.String |
HTTP_BADREQUEST
Some HTTP response status codes |
static java.lang.String |
HTTP_FORBIDDEN
Some HTTP response status codes |
static java.lang.String |
HTTP_INTERNALERROR
Some HTTP response status codes |
static java.lang.String |
HTTP_NOTFOUND
Some HTTP response status codes |
static java.lang.String |
HTTP_NOTIMPLEMENTED
Some HTTP response status codes |
static java.lang.String |
HTTP_OK
Some HTTP response status codes |
static java.lang.String |
HTTP_REDIRECT
Some HTTP response status codes |
static java.lang.String |
LICENCE
The distribution licence |
static java.lang.String |
MIME_DEFAULT_BINARY
Common mime types for dynamic content |
static java.lang.String |
MIME_HTML
Common mime types for dynamic content |
static java.lang.String |
MIME_PLAINTEXT
Common mime types for dynamic content |
(package private) java.io.File |
myFileDir
|
private int |
myTcpPort
|
private static java.util.Hashtable |
theMimeTypes
Hashtable mapping (String)FILENAME_EXTENSION -> (String)MIME_TYPE |
Constructor Summary | |
---|---|
NanoHTTPD(int port)
Starts a HTTP server to given port. |
|
NanoHTTPD(int port,
java.lang.String directory)
|
Method Summary | |
---|---|
private java.lang.String |
encodeUri(java.lang.String uri)
URL-encodes everything between "/"-characters. |
static void |
main(java.lang.String[] args)
Starts as a standalone file server and waits for Enter. |
NanoHTTPD.Response |
serve(java.lang.String uri,
java.lang.String method,
java.util.Properties header,
java.util.Properties parms)
Override this to customize the server. |
NanoHTTPD.Response |
serveFile(java.lang.String uri,
java.util.Properties header,
java.io.File homeDir,
boolean allowDirectoryListing)
Serves file from homeDir and its' subdirectories (only). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String HTTP_OK
public static final java.lang.String HTTP_REDIRECT
public static final java.lang.String HTTP_FORBIDDEN
public static final java.lang.String HTTP_NOTFOUND
public static final java.lang.String HTTP_BADREQUEST
public static final java.lang.String HTTP_INTERNALERROR
public static final java.lang.String HTTP_NOTIMPLEMENTED
public static final java.lang.String MIME_PLAINTEXT
public static final java.lang.String MIME_HTML
public static final java.lang.String MIME_DEFAULT_BINARY
private int myTcpPort
java.io.File myFileDir
private static java.util.Hashtable theMimeTypes
private static java.text.SimpleDateFormat gmtFrmt
public static final java.lang.String LICENCE
Constructor Detail |
---|
public NanoHTTPD(int port) throws java.io.IOException
Throws an IOException if the socket is already in use
java.io.IOException
public NanoHTTPD(int port, java.lang.String directory) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public NanoHTTPD.Response serve(java.lang.String uri, java.lang.String method, java.util.Properties header, java.util.Properties parms)
(By default, this delegates to serveFile() and allows directory listing.)
public static void main(java.lang.String[] args)
private java.lang.String encodeUri(java.lang.String uri)
public NanoHTTPD.Response serveFile(java.lang.String uri, java.util.Properties header, java.io.File homeDir, boolean allowDirectoryListing)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |