|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.autoandroid.positron.NanoHTTPD
public class NanoHTTPD
A simple, tiny, nicely embeddable HTTP 1.0 server in Java.
This class has been trivially modified from its original form, taken from http://elonen.iki.fi/code/nanohttpd/NanoHTTPD.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 | |
---|---|
static class |
NanoHTTPD.Response
HTTP response. |
Field Summary | |
---|---|
static String |
HTTP_BADREQUEST
Some HTTP response status codes |
static String |
HTTP_FORBIDDEN
Some HTTP response status codes |
static String |
HTTP_INTERNALERROR
Some HTTP response status codes |
static String |
HTTP_NOTFOUND
Some HTTP response status codes |
static String |
HTTP_NOTIMPLEMENTED
Some HTTP response status codes |
static String |
HTTP_OK
Some HTTP response status codes |
static String |
HTTP_REDIRECT
Some HTTP response status codes |
static String |
MIME_DEFAULT_BINARY
Common mime types for dynamic content |
static String |
MIME_HTML
Common mime types for dynamic content |
static String |
MIME_PLAINTEXT
Common mime types for dynamic content |
Constructor Summary | |
---|---|
NanoHTTPD(int port)
Starts a HTTP server to given port. |
Method Summary | |
---|---|
static void |
main(String[] args)
Starts as a standalone file server and waits for Enter. |
protected void |
onSessionClose()
|
NanoHTTPD.Response |
serve(String uri,
String method,
Properties header,
Properties parms)
Override this to customize the server. |
NanoHTTPD.Response |
serveFile(String uri,
Properties header,
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 String HTTP_OK
public static final String HTTP_REDIRECT
public static final String HTTP_FORBIDDEN
public static final String HTTP_NOTFOUND
public static final String HTTP_BADREQUEST
public static final String HTTP_INTERNALERROR
public static final String HTTP_NOTIMPLEMENTED
public static final String MIME_PLAINTEXT
public static final String MIME_HTML
public static final String MIME_DEFAULT_BINARY
Constructor Detail |
---|
public NanoHTTPD(int port) throws IOException
Throws an IOException if the socket is already in use
IOException
Method Detail |
---|
public NanoHTTPD.Response serve(String uri, String method, Properties header, Properties parms)
(By default, this delegates to serveFile() and allows directory listing.)
uri
- Percent-decoded URI without parameters, for example "/index.cgi"method
- "GET", "POST" etc.parms
- Parsed, percent decoded parameters from URI and, in case of POST, data.header
- Header entries, percent decoded
public static void main(String[] args)
protected void onSessionClose()
public NanoHTTPD.Response serveFile(String uri, Properties header, File homeDir, boolean allowDirectoryListing)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |