Class RemoteControlHttpServer
- java.lang.Object
-
- java.lang.Thread
-
- org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpServer
-
- All Implemented Interfaces:
java.lang.Runnable
public class RemoteControlHttpServer extends java.lang.Thread
Simple HTTP server that spawns aRequestProcessorfor every connection. Taken from YWMS plugin by frsantos.
-
-
Field Summary
Fields Modifier and Type Field Description private static RemoteControlHttpServerinstance4The server instance for IPv4private static RemoteControlHttpServerinstance6The server instance for IPv6private java.net.ServerSocketserverThe server socket
-
Constructor Summary
Constructors Constructor Description RemoteControlHttpServer(int port, boolean ipv6)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidrestartRemoteControlHttpServer()Starts or restarts the HTTP servervoidrun()The main loop, spawns aRequestProcessorfor each connectionstatic voidstopRemoteControlHttpServer()Stops the HTTP servervoidstopServer()Stops the HTTP server-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
server
private final java.net.ServerSocket server
The server socket
-
instance4
private static volatile RemoteControlHttpServer instance4
The server instance for IPv4
-
instance6
private static volatile RemoteControlHttpServer instance6
The server instance for IPv6
-
-
Constructor Detail
-
RemoteControlHttpServer
public RemoteControlHttpServer(int port, boolean ipv6) throws java.io.IOException
Constructor- Parameters:
port- The port this server will listen onipv6- Whether IPv6 or IPv4 server should be started- Throws:
java.io.IOException- when connection errors- Since:
- 8339
-
-
Method Detail
-
restartRemoteControlHttpServer
public static void restartRemoteControlHttpServer()
Starts or restarts the HTTP server
-
stopRemoteControlHttpServer
public static void stopRemoteControlHttpServer()
Stops the HTTP server- Since:
- 5861
-
run
public void run()
The main loop, spawns aRequestProcessorfor each connection- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
stopServer
public void stopServer() throws java.io.IOException
Stops the HTTP server- Throws:
java.io.IOException- if any I/O error occurs
-
-