|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
public abstract class RequestHandler
This is the parent of all classes that handle a specific remote control command
| Nested Class Summary | |
|---|---|
static class |
RequestHandler.RequestHandlerBadRequestException
|
static class |
RequestHandler.RequestHandlerErrorException
|
static class |
RequestHandler.RequestHandlerException
|
static class |
RequestHandler.RequestHandlerForbiddenException
|
| Field Summary | |
|---|---|
protected java.util.HashMap<java.lang.String,java.lang.String> |
args
The GET request arguments |
protected java.lang.String |
content
default response |
protected java.lang.String |
contentType
default content type |
static boolean |
globalConfirmationDefault
|
static java.lang.String |
globalConfirmationKey
|
static boolean |
loadInNewLayerDefault
|
static java.lang.String |
loadInNewLayerKey
|
protected java.lang.String |
myCommand
will be filled with the command assigned to the subclass |
protected java.lang.String |
request
The request URL without "GET". |
| Constructor Summary | |
|---|---|
RequestHandler()
|
|
| Method Summary | |
|---|---|
(package private) void |
checkMandatoryParams()
|
void |
checkPermission()
Check permissions in preferences and display error message or ask for permission. |
java.lang.String |
getContent()
|
java.lang.String |
getContentType()
|
abstract java.lang.String[] |
getMandatoryParams()
|
abstract java.lang.String |
getPermissionMessage()
Get a specific message to ask the user for permission for the operation requested via remote control. |
abstract PermissionPrefWithDefault |
getPermissionPref()
Get a PermissionPref object containing the name of a special permission preference to individually allow the requested operation and an error message to be displayed when a disabled operation is requested. |
void |
handle()
Check permission and parameters and handle request. |
protected abstract void |
handleRequest()
Handle a specific command sent as remote control. |
protected boolean |
isLoadInNewLayer()
|
protected void |
parseArgs()
Parse the request parameters as key=value pairs. |
void |
setCommand(java.lang.String command)
Save command associated with this handler. |
void |
setUrl(java.lang.String url)
Set request URL and parse args. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String globalConfirmationKey
public static final boolean globalConfirmationDefault
public static final java.lang.String loadInNewLayerKey
public static final boolean loadInNewLayerDefault
protected java.util.HashMap<java.lang.String,java.lang.String> args
protected java.lang.String request
protected java.lang.String content
protected java.lang.String contentType
protected java.lang.String myCommand
| Constructor Detail |
|---|
public RequestHandler()
| Method Detail |
|---|
public final void handle()
throws RequestHandler.RequestHandlerForbiddenException,
RequestHandler.RequestHandlerBadRequestException,
RequestHandler.RequestHandlerErrorException
RequestHandler.RequestHandlerForbiddenException
RequestHandler.RequestHandlerBadRequestException
RequestHandler.RequestHandlerErrorException
protected abstract void handleRequest()
throws RequestHandler.RequestHandlerErrorException,
RequestHandler.RequestHandlerBadRequestException
RequestHandler.RequestHandlerErrorException
RequestHandler.RequestHandlerBadRequestExceptionpublic abstract java.lang.String getPermissionMessage()
public abstract PermissionPrefWithDefault getPermissionPref()
public abstract java.lang.String[] getMandatoryParams()
public final void checkPermission()
throws RequestHandler.RequestHandlerForbiddenException
RequestHandler.RequestHandlerForbiddenExceptionpublic void setUrl(java.lang.String url)
url - The request URL.protected void parseArgs()
this.args.
Can be overridden by subclass.
void checkMandatoryParams()
throws RequestHandler.RequestHandlerBadRequestException
RequestHandler.RequestHandlerBadRequestExceptionpublic void setCommand(java.lang.String command)
command - The command.public java.lang.String getContent()
public java.lang.String getContentType()
protected boolean isLoadInNewLayer()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||