Package org.jolokia.server.core.request
Class JolokiaRequest
java.lang.Object
org.jolokia.server.core.request.JolokiaRequest
- Direct Known Subclasses:
JolokiaListRequest,JolokiaNotificationRequest,JolokiaObjectNameRequest,JolokiaVersionRequest
Abstract base class for a JMX request. This is the server side
representation of a Jolokia request.
- Since:
- 15.03.11
- Author:
- roland
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJolokiaRequest(Map<String, ?> pMap, ProcessingParameters pProcessingParams, boolean pExclusive) Constructor used forHttpMethod.POSTrequests, which receive a JSON payload.protectedJolokiaRequest(RequestType pType, List<String> pPathParts, ProcessingParameters pProcessingParams, boolean pExclusive) Constructor used for representingHttpMethod.GETrequests. -
Method Summary
Modifier and TypeMethodDescriptionHTTP method used for creating this requestprotected StringgetInfo()Textual description of this request containing base information.<T> TGet an option from the request.getParameter(ConfigKey pConfigKey) Get a processing configuration or null if not setgetParameterAsBool(ConfigKey pConfigKey) Get a processing configuration as a boolean valueintgetParameterAsInt(ConfigKey pConfigKey) Get a processing configuration as integer or null if not setgetPath()Get the path combined with proper escapingGet the parts of a pathgetType()Get request typeGet tha value fault handler, which can be passed around.booleanWhether this request is an exclusive request or not.org.json.simple.JSONObjecttoJSON()Convert this request to a JSON object, which can be used as a part of a return value.booleanWhether a return value should be returned directly, ignoring any path.
-
Constructor Details
-
JolokiaRequest
protected JolokiaRequest(RequestType pType, List<String> pPathParts, ProcessingParameters pProcessingParams, boolean pExclusive) Constructor used for representingHttpMethod.GETrequests. The final parameterpExclusivedecides whether this request is an 'exclusive' request, i.e. whether the processing is done exclusively by a handler or whether multiple requests handlers can add to the result. Good examples are "list" requests which collects the results from multiple request handlers whereas "read" only reads the values from a single requesthandler- Parameters:
pType- request typepPathParts- an optional path, split up in parts. Not all requests do handle a path.pProcessingParams- init parameters provided as query params for a GET request. They are used to to influence the processing.pExclusive- whether the request is an 'exclusive' request or not.
-
JolokiaRequest
protected JolokiaRequest(Map<String, ?> pMap, ProcessingParameters pProcessingParams, boolean pExclusive) Constructor used forHttpMethod.POSTrequests, which receive a JSON payload.- Parameters:
pMap- map containing requests parameters§pProcessingParams- optional processing parameters (obtained as query parameters or from within the JSON request)pExclusive- whether the request is an 'exclusive' request or not handled by a single handler only
-
-
Method Details
-
getType
Get request type- Returns:
- request type of this request.
-
getParameter
Get a processing configuration or null if not set- Parameters:
pConfigKey- configuration key to fetch- Returns:
- string value or
nullif not set
-
getParameterAsInt
Get a processing configuration as integer or null if not set- Parameters:
pConfigKey- configuration to lookup- Returns:
- integer value of configuration or 0 if not set.
-
getParameterAsBool
Get a processing configuration as a boolean value- Parameters:
pConfigKey- configuration to lookup- Returns:
- boolean value of the configuration, the default value or false if the default value is null
-
getOption
Get an option from the request. Options are used to help request dispatchers in serving a request for a specific provider. E.g. the Jsr160 request dispatchers uses this in order to obtain the JSR-160 target information.- Parameters:
pKey- get the option for this key- Returns:
- the specificied option or or null if no such option was set
-
isExclusive
public boolean isExclusive()Whether this request is an exclusive request or not. SeeJolokiaRequest(RequestType, List, ProcessingParameters, boolean)for details- Returns:
- true if this is a request handled by a single handler.
-
getHttpMethod
HTTP method used for creating this request- Returns:
- HTTP method which lead to this request
-
getValueFaultHandler
Get tha value fault handler, which can be passed around.- Returns:
- the value fault handler
-
useReturnValueWithPath
public boolean useReturnValueWithPath()Whether a return value should be returned directly, ignoring any path. In this case this method should return false. By default, a path needs to be applied to the returned value afterwards in order to get the desired value.- Returns:
- true if the path within the request should be respected when generating the answer later, false if the value should be directly returned
-
getInfo
Textual description of this request containing base information. Can be used in toString() methods of subclasses.- Returns:
- description of this base request
-
getPathParts
Get the parts of a path- Returns:
- the parts of an path or null if no path was used
-
getPath
Get the path combined with proper escaping- Returns:
- path as string or null if no path is given.
-
toJSON
public org.json.simple.JSONObject toJSON()Convert this request to a JSON object, which can be used as a part of a return value.- Returns:
- JSON object representing this base request object
-