public class HttpServer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpServer.RequestHandler
Class RequestHandler handles requests
|
Modifier and Type | Field and Description |
---|---|
static int |
RESPONSE_INTERNALERROR
_more_
|
static int |
RESPONSE_NOTFOUND
_more_
|
static int |
RESPONSE_OK
_more_
|
static int |
RESPONSE_UNAUTHORIZED
_more_
|
protected java.util.Hashtable |
serverProperties
_more_
|
static java.lang.String |
TYPE_GET
get type
|
static java.lang.String |
TYPE_POST
post type
|
Constructor and Description |
---|
HttpServer(int port)
Create me with the given port
|
HttpServer(java.lang.String propertyFile)
_more_
|
Modifier and Type | Method and Description |
---|---|
protected HttpServer.RequestHandler |
doMakeRequestHandler(java.net.Socket socket)
Factory method to create the request handler
|
int |
getPort()
_more_
|
java.util.Hashtable |
getProperties()
_more_
|
protected void |
handleError(java.lang.String msg,
java.lang.Exception exc)
_more_
|
void |
init()
_more_
|
protected void |
initServerSocket(java.net.ServerSocket socket)
_more_
|
void |
setPort(int port)
_more_
|
static void |
xxxxmain(java.lang.String[] args)
test main
|
public static final int RESPONSE_OK
public static final int RESPONSE_NOTFOUND
public static final int RESPONSE_UNAUTHORIZED
public static final int RESPONSE_INTERNALERROR
public static final java.lang.String TYPE_GET
public static final java.lang.String TYPE_POST
protected java.util.Hashtable serverProperties
public HttpServer(int port)
port
- The port to listen onpublic HttpServer(java.lang.String propertyFile)
propertyFile
- _more_public void setPort(int port)
port
- _more_public int getPort()
public java.util.Hashtable getProperties()
public void init()
protected void handleError(java.lang.String msg, java.lang.Exception exc)
msg
- _more_exc
- _more_protected void initServerSocket(java.net.ServerSocket socket)
socket
- _more_protected HttpServer.RequestHandler doMakeRequestHandler(java.net.Socket socket) throws java.lang.Exception
socket
- The socketjava.lang.Exception
- On badnesspublic static void xxxxmain(java.lang.String[] args)
args
- args