|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.openstreetmap.josm.io.remotecontrol.RequestProcessor
public class RequestProcessor
Processes HTTP "remote control" requests.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private static java.util.Map<java.lang.String,java.lang.Class<? extends RequestHandler>> |
handlers
Collection of request handlers. |
static java.lang.String |
PROTOCOLVERSION
RemoteControl protocol version. |
private java.net.Socket |
request
The socket this processor listens on |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
RequestProcessor(java.net.Socket request)
Constructor |
|
| Method Summary | |
|---|---|
(package private) static void |
addRequestHandlerClass(java.lang.String command,
java.lang.Class<? extends RequestHandler> handler)
Add external request handler. |
private static void |
addRequestHandlerClass(java.lang.String command,
java.lang.Class<? extends RequestHandler> handler,
boolean silent)
Add external request handler. |
static void |
processRequest(java.net.Socket request)
Spawns a new thread for the request |
void |
run()
The work is done here. |
private void |
sendBadRequest(java.io.Writer out,
java.lang.String help)
Sends a 403 error: forbidden |
private void |
sendError(java.io.Writer out)
Sends a 500 error: server error |
private void |
sendForbidden(java.io.Writer out,
java.lang.String help)
Sends a 403 error: forbidden |
private void |
sendHeader(java.io.Writer out,
java.lang.String status,
java.lang.String contentType,
boolean endHeaders)
Send common HTTP headers to the client. |
private void |
sendNotImplemented(java.io.Writer out)
Sends a 501 error: not implemented |
| 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 |
|---|
public static final java.lang.String PROTOCOLVERSION
private java.net.Socket request
private static java.util.Map<java.lang.String,java.lang.Class<? extends RequestHandler>> handlers
| Constructor Detail |
|---|
public RequestProcessor(java.net.Socket request)
request - A socket to read the request.| Method Detail |
|---|
public static void processRequest(java.net.Socket request)
static void addRequestHandlerClass(java.lang.String command,
java.lang.Class<? extends RequestHandler> handler)
command - The command to handle.handler - The additional request handler.
private static void addRequestHandlerClass(java.lang.String command,
java.lang.Class<? extends RequestHandler> handler,
boolean silent)
command - The command to handle.handler - The additional request handler.silent - Don't show message if true.public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
private void sendError(java.io.Writer out)
throws java.io.IOException
out - The writer where the error is written
java.io.IOException - If the error can not be written
private void sendNotImplemented(java.io.Writer out)
throws java.io.IOException
out - The writer where the error is written
java.io.IOException - If the error can not be written
private void sendForbidden(java.io.Writer out,
java.lang.String help)
throws java.io.IOException
out - The writer where the error is written
java.io.IOException - If the error can not be written
private void sendBadRequest(java.io.Writer out,
java.lang.String help)
throws java.io.IOException
out - The writer where the error is written
java.io.IOException - If the error can not be written
private void sendHeader(java.io.Writer out,
java.lang.String status,
java.lang.String contentType,
boolean endHeaders)
throws java.io.IOException
out - The Writerstatus - The status string ("200 OK", "500", etc)contentType - The content type of the data sentendHeaders - If true, adds a new line, ending the headers.
java.io.IOException - When error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||