|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tue.id.tim.HttpServer
A simple http server that implements HTTP/1.0 GET.
Description: The http server has its default port at 8080, and the default root directory at where the program is started. All the url links are supposed to be UTF-8 encoded.
Copyright: Copyright (c) 2005 Jun Hu
Company: ID, TU/e
Nested Class Summary | |
(package private) class |
HttpServer.HttpServerConnection
Http server connection. |
Field Summary | |
private int |
port
port number of the http server. |
private java.lang.String |
root
the root directory of the http server. |
(package private) boolean |
running
a switch for start and stop the http server. |
(package private) java.net.ServerSocket |
ss
server socket |
Constructor Summary | |
HttpServer()
|
Method Summary | |
int |
getPort()
return the root number. |
java.lang.String |
getRoot()
return the root directory. |
private void |
jbInit()
|
static void |
main(java.lang.String[] argv)
for testing as a standalone server. |
void |
run()
a http server is always started in a new thread, awaiting the connections from the clients. |
void |
setPort(int port)
setter for the port. |
void |
setRoot(java.lang.String root)
setter for the root. |
void |
start()
start the http server as a new thread. |
void |
stop()
stop the http server. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int port
private java.lang.String root
java.net.ServerSocket ss
boolean running
Constructor Detail |
public HttpServer()
Method Detail |
public static void main(java.lang.String[] argv) throws java.io.IOException
argv
- String[]
java.io.IOException
public void start() throws java.io.IOException
java.io.IOException
public void stop() throws java.io.IOException
java.io.IOException
public void setPort(int port)
port
- intpublic void setRoot(java.lang.String root)
root
- Stringpublic int getPort()
public java.lang.String getRoot()
public void run()
run
in interface java.lang.Runnable
private void jbInit() throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |