|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.dalsemi.tininet.http.HTTPServer
This class implements an HTTP server. This class currently only supports the GET method.
The POST method will be supported when java.lang.Runtime.exec() support is added. POST
requests currently echo the posted data.
"serviceRequests" blocks on a ServerSocket accept call. A new thread is
spawned to service each new connection.
| Field Summary | |
static int |
DEFAULT_HTTP_PORT
|
static int |
DELETE
|
static int |
GET
|
static int |
HEAD
|
static int |
HTTP_BAD_REQUEST
|
static int |
HTTP_CREATED
|
static int |
HTTP_FORBIDDEN
|
static int |
HTTP_INTERNAL_ERROR
|
static int |
HTTP_NOT_FOUND
|
static int |
HTTP_OK
|
static int |
HTTP_SERVER_ERROR
|
static int |
HTTP_UNAUTHORIZED
|
static int |
HTTP_UNSUPPORTED_TYPE
|
static int |
OPTIONS
|
static int |
POST
|
static int |
PUT
|
static int |
TRACE
|
static int |
TYPE_FULL_REQUEST
|
static int |
TYPE_FULL_RESPONSE
|
static int |
TYPE_SIMPLE_REQUEST
|
static int |
UNSUPPORTED
|
| Constructor Summary | |
HTTPServer()
Default constructor. |
|
HTTPServer(int httpPort)
Creates an HTTPServer using port httpPort. |
|
HTTPServer(int httpPort,
boolean logEnabled)
Creates an HTTPServer using port httpPort. |
|
| Method Summary | |
java.lang.String |
getHTTPRoot()
Returns the HTTP root of the server. |
java.lang.String |
getIndexPage()
Returns the server's index page. |
java.lang.String |
getLogFilename()
Returns the name of the log file. |
boolean |
getLogging()
Returns the logging status. |
int |
getPortNumber()
Returns the server's current port number. |
int |
serviceRequests()
Checks for incoming client HTTP request and services supported requests that are detected. |
int |
serviceRequests(java.lang.Object lock)
Checks for incoming client HTTP request and services supported requests that are detected. |
void |
setHTTPRoot(java.lang.String httpRoot)
Sets the http root. |
void |
setIndexPage(java.lang.String indexPage)
Sets the servers index page. |
void |
setLogFilename(java.lang.String logFileName)
Sets the log file name. |
void |
setLogging(boolean logEnabled)
Sets the logging status. |
void |
setPortNumber(int httpPort)
Sets the server's port number. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int HTTP_OK
public static final int HTTP_CREATED
public static final int HTTP_BAD_REQUEST
public static final int HTTP_UNAUTHORIZED
public static final int HTTP_FORBIDDEN
public static final int HTTP_NOT_FOUND
public static final int HTTP_UNSUPPORTED_TYPE
public static final int HTTP_SERVER_ERROR
public static final int HTTP_INTERNAL_ERROR
public static final int TYPE_SIMPLE_REQUEST
public static final int TYPE_FULL_REQUEST
public static final int TYPE_FULL_RESPONSE
public static final int DEFAULT_HTTP_PORT
public static final int UNSUPPORTED
public static final int GET
public static final int POST
public static final int HEAD
public static final int OPTIONS
public static final int PUT
public static final int DELETE
public static final int TRACE
| Constructor Detail |
public HTTPServer()
throws HTTPServerException
public HTTPServer(int httpPort)
throws HTTPServerException
httpPort - port number for server.
public HTTPServer(int httpPort,
boolean logEnabled)
throws HTTPServerException
httpPort - port number for server.logEnabled - set logging option.| Method Detail |
public boolean getLogging()
public void setLogging(boolean logEnabled)
throws HTTPServerException
logEnabled - true if the server is to write to a default log file.public java.lang.String getLogFilename()
public void setLogFilename(java.lang.String logFileName)
logFileName - name of the log filepublic java.lang.String getHTTPRoot()
public void setHTTPRoot(java.lang.String httpRoot)
httpRoot - path indicating the root of the server.public java.lang.String getIndexPage()
public void setIndexPage(java.lang.String indexPage)
indexPage - page to be used by the server as a default index page.public int getPortNumber()
public void setPortNumber(int httpPort)
throws HTTPServerException
httpPort - number of the port to be opened.
public int serviceRequests()
throws HTTPServerException
public int serviceRequests(java.lang.Object lock)
throws HTTPServerException
lock - - lock for exclusive access to web page.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||