Class JolokiaRequest

java.lang.Object
org.jolokia.server.core.request.JolokiaRequest
Direct Known Subclasses:
JolokiaListRequest, JolokiaNotificationRequest, JolokiaObjectNameRequest, JolokiaVersionRequest

public abstract class JolokiaRequest extends Object
Abstract base class for a JMX request. This is the server side representation of a Jolokia request.
Since:
15.03.11
Author:
roland
  • Constructor Details

    • JolokiaRequest

      protected JolokiaRequest(RequestType pType, List<String> pPathParts, ProcessingParameters pProcessingParams, boolean pExclusive)
      Constructor used for representing HttpMethod.GET requests. The final parameter pExclusive decides 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 type
      pPathParts - 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 for HttpMethod.POST requests, 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

      public RequestType getType()
      Get request type
      Returns:
      request type of this request.
    • getParameter

      public String getParameter(ConfigKey pConfigKey)
      Get a processing configuration or null if not set
      Parameters:
      pConfigKey - configuration key to fetch
      Returns:
      string value or null if not set
    • getParameterAsInt

      public int getParameterAsInt(ConfigKey pConfigKey)
      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

      public Boolean getParameterAsBool(ConfigKey pConfigKey)
      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

      public <T> T getOption(String pKey)
      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. See JolokiaRequest(RequestType, List, ProcessingParameters, boolean) for details
      Returns:
      true if this is a request handled by a single handler.
    • getHttpMethod

      public HttpMethod getHttpMethod()
      HTTP method used for creating this request
      Returns:
      HTTP method which lead to this request
    • getValueFaultHandler

      public ValueFaultHandler 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

      protected String getInfo()
      Textual description of this request containing base information. Can be used in toString() methods of subclasses.
      Returns:
      description of this base request
    • getPathParts

      public List<String> getPathParts()
      Get the parts of a path
      Returns:
      the parts of an path or null if no path was used
    • getPath

      public String 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