org.openstreetmap.josm.io.remotecontrol
Class RemoteControlHttpServer

java.lang.Object
  extended by java.lang.Thread
      extended by org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpServer
All Implemented Interfaces:
java.lang.Runnable

public class RemoteControlHttpServer
extends java.lang.Thread

Simple HTTP server that spawns a RequestProcessor for every connection. Taken from YWMS plugin by frsantos.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_PORT
          Default port for the HTTP server
private static RemoteControlHttpServer instance
           
private  java.net.ServerSocket server
          The server socket
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RemoteControlHttpServer(int port)
          Constructor
 
Method Summary
static void restartRemoteControlHttpServer()
          Starts or restarts the HTTP server
 void run()
          The main loop, spawns a RequestProcessor for each connection
 void stopServer()
          Stops the HTTP server
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
Default port for the HTTP server

See Also:
Constant Field Values

server

private java.net.ServerSocket server
The server socket


instance

private static RemoteControlHttpServer instance
Constructor Detail

RemoteControlHttpServer

public RemoteControlHttpServer(int port)
                        throws java.io.IOException
Constructor

Parameters:
port - The port this server will listen on
Throws:
java.io.IOException - when connection errors
Method Detail

restartRemoteControlHttpServer

public static void restartRemoteControlHttpServer()
Starts or restarts the HTTP server


run

public void run()
The main loop, spawns a RequestProcessor for each connection

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stopServer

public void stopServer()
                throws java.io.IOException
Stops the HTTP server

Throws:
java.io.IOException


JOSM