jmri.web.miniserver
Class MiniServer

java.lang.Object
  extended by jmri.web.miniserver.NetworkServer
      extended by jmri.web.miniserver.MiniServer
Direct Known Subclasses:
ThreadedMiniServer

public class MiniServer
extends NetworkServer

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.

Author:
Modifications by Bob Jacobsen Copyright 2005, 2006

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

maxRequestLines

protected int maxRequestLines

serverName

protected String serverName
Constructor Detail

MiniServer

public MiniServer(int port,
                  int maxConnections)
Method Detail

main

public static void main(String[] args)
Run standalone.

Supply a port number as a command-line argument. Otherwise, use port 12080.


handleConnection

public void handleConnection(Socket server)
                      throws IOException
Overrides the NetworkServer handleConnection method to invoke a particular servlet.

Overrides:
handleConnection in class NetworkServer
Throws:
IOException

pickServlet

public javax.servlet.Servlet pickServlet(String name)
Scan URL, trying to make the longest match against the servlet properties.

Returns:
new Servlet object matching this request

getLocalAddress

public String getLocalAddress()

getPort

public int getPort()
Description copied from class: NetworkServer
Gets port on which server is listening.

Overrides:
getPort in class NetworkServer


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads