AI2 Component
(Version nb184)
|
Classes | |
class | Response |
Public Member Functions | |
Response | serve (String uri, String method, Properties header, Properties parms, Properties files, Socket mySocket) |
NanoHTTPD (int port, File wwwroot) throws IOException | |
void | stop () |
Response | serveFile (String uri, Properties header, File homeDir, boolean allowDirectoryListing) |
Static Public Member Functions | |
static void | main (String[] args) |
Static Public Attributes | |
static final String | HTTP_OK = "200 OK" |
static final String | MIME_PLAINTEXT = "text/plain" |
Static Protected Attributes | |
static PrintStream | myOut = System.out |
static PrintStream | myErr = System.err |
A simple, tiny, nicely embeddable HTTP 1.0 (partially 1.1) server in Java
NanoHTTPD version 1.25, Copyright © 2001,2005-2012 Jarno Elonen (elone, n@ik i.fihttp://iki.fi/elonen/) and Copyright © 2010 Konstantinos Togias (info@, ktog ias.g rhttp://ktogias.gr)
Improvements in Thread Handling (pooling) by Jeffrey I. Schiller (jis@m) it.e du
Features + limitations:
All header names are converted lowercase so they don't vary between browsers/clients
Ways to use:
Call serveFile() from serve() with your own base directory
See the end of the source file for distribution license (Modified BSD licence)
Definition at line 82 of file NanoHTTPD.java.
com.google.appinventor.components.runtime.util.NanoHTTPD.NanoHTTPD | ( | int | port, |
File | wwwroot | ||
) | throws IOException |
Starts a HTTP server to given port.
Throws an IOException if the socket is already in use
Definition at line 240 of file NanoHTTPD.java.
|
static |
Starts as a standalone file server and waits for Enter.
Definition at line 280 of file NanoHTTPD.java.
Response com.google.appinventor.components.runtime.util.NanoHTTPD.serve | ( | String | uri, |
String | method, | ||
Properties | header, | ||
Properties | parms, | ||
Properties | files, | ||
Socket | mySocket | ||
) |
Override this to customize the server.
(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 |
Reimplemented in com.google.appinventor.components.runtime.util.AppInvHTTPD.
Definition at line 104 of file NanoHTTPD.java.
Response com.google.appinventor.components.runtime.util.NanoHTTPD.serveFile | ( | String | uri, |
Properties | header, | ||
File | homeDir, | ||
boolean | allowDirectoryListing | ||
) |
Serves file from homeDir and its' subdirectories (only). Uses only URI, ignores all headers and HTTP parameters.
Definition at line 895 of file NanoHTTPD.java.
void com.google.appinventor.components.runtime.util.NanoHTTPD.stop | ( | ) |
Stops the server.
Definition at line 265 of file NanoHTTPD.java.
|
static |
Some HTTP response status codes
Definition at line 209 of file NanoHTTPD.java.
|
static |
Common mime types for dynamic content
Definition at line 224 of file NanoHTTPD.java.
|
staticprotected |
Definition at line 1128 of file NanoHTTPD.java.
|
staticprotected |
Definition at line 1127 of file NanoHTTPD.java.