|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.web.miniserver.NetworkServer
jmri.web.miniserver.MiniServer
public class MiniServer
A simple HTTP server that generates a Web page showing all of the data that it received from the Web client (usually a browser). To use this server, start it on the system of your choice, supplying a port number if you want something other than port 12080. Call this system server.com. Next, start a Web browser on the same or a different system, and connect to http://server.com:12080/whatever. The resultant Web page will show the data that your browser sent. For debugging in servlet or CGI programming, specify http://server.com:12080/whatever as the ACTION of your HTML form. You can send GET or POST data; either way, the resultant page will show what your browser sent.
Adapted with permission from Core Web Programming from Prentice Hall and Sun Microsystems Press, http://www.corewebprogramming.com/. © 2001 Marty Hall and Larry Brown; may be freely used or adapted.
| Field Summary | |
|---|---|
protected int |
maxRequestLines
|
protected String |
serverName
|
| Fields inherited from class jmri.web.miniserver.NetworkServer |
|---|
port |
| Constructor Summary | |
|---|---|
MiniServer(int port,
int maxConnections)
|
|
| Method Summary | |
|---|---|
String |
getLocalAddress()
|
int |
getPort()
Gets port on which server is listening. |
void |
handleConnection(Socket server)
Overrides the NetworkServer handleConnection method to invoke a particular servlet. |
static void |
main(String[] args)
Run standalone. |
javax.servlet.Servlet |
pickServlet(String name)
Scan URL, trying to make the longest match against the servlet properties. |
| Methods inherited from class jmri.web.miniserver.NetworkServer |
|---|
getMaxConnections, listen, setMaxConnections, setPort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int maxRequestLines
protected String serverName
| Constructor Detail |
|---|
public MiniServer(int port,
int maxConnections)
| Method Detail |
|---|
public static void main(String[] args)
Supply a port number as a command-line argument. Otherwise, use port 12080.
public void handleConnection(Socket server)
throws IOException
handleConnection in class NetworkServerIOExceptionpublic javax.servlet.Servlet pickServlet(String name)
public String getLocalAddress()
public int getPort()
NetworkServer
getPort in class NetworkServer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||