Class JolokiaRequestFactory

java.lang.Object
org.jolokia.server.core.request.JolokiaRequestFactory

public final class JolokiaRequestFactory extends Object
Factory for creating JolokiaRequests
Since:
Oct 29, 2009
Author:
roland
  • Method Details

    • createGetRequest

      public static <R extends JolokiaRequest> R createGetRequest(String pPathInfo, ProcessingParameters pProcessingParameters)
      Create a JMX request from a GET Request with a REST Url.

      The REST-Url which gets recognized has the following format:

          <base_url>/<type>/<param1>/<param2>/....
       

      where base_url is the URL specifying the overall servlet (including the servlet context, something like "http://localhost:8080/j4p-agent"), type the operational mode and param1 .. paramN the provided parameters which are dependend on the type

      The following types are recognized so far, along with there parameters:

      • Type: read (RequestType.READ
        Parameters: param1 = MBean name, param2 = Attribute name, param3 ... paramN = Inner Path. The inner path is optional and specifies a path into complex MBean attributes like collections or maps. If within collections/arrays/tabular data, paramX should specify a numeric index, in maps/composite data paramX is a used as a string key.
      • . If the attribute name contains "," it is interpreted as a list of attributes. which should be returned.
      • Type: write (RequestType.WRITE
        Parameters: param1 = MBean name, param2 = Attribute name, param3 = value, param4 ... paramN = Inner Path. The value must be URL encoded (with UTF-8 as charset), and must be convertible into a data structure
      • Type: exec (RequestType.EXEC
        Parameters: param1 = MBean name, param2 = operation name, param4 ... paramN = arguments for the operation. The arguments must be URL encoded (with UTF-8 as charset), and must be convertable into a data structure
      • Type: version (RequestType.VERSION
        Parameters: none
      • Type: search (RequestType.SEARCH
        Parameters: param1 = MBean name pattern
      Parameters:
      pPathInfo - path info of HTTP request
      pProcessingParameters - processing parameters. Must not be null/
      Returns:
      a newly created JolokiaRequest
    • createPostRequest

      public static <R extends JolokiaRequest> R createPostRequest(Map<String,?> pRequestMap, ProcessingParameters pProcessingParams)
      Create a single JolokiaRequests from a JSON map representation of a request
      Parameters:
      pRequestMap - JSON representation of a JolokiaRequest
      pProcessingParams - additional map of operational parameters. Must not be null.
      Returns:
      the created JolokiaRequest
    • createPostRequests

      public static List<JolokiaRequest> createPostRequests(List<?> pJsonRequests, ProcessingParameters pProcessingParams)
      Create a list of JolokiaRequests from a JSON list representing jmx requests
      Parameters:
      pJsonRequests - JSON representation of a list of JolokiaRequest
      pProcessingParams - processing options. Must not be null.
      Returns:
      list with one or more JolokiaRequest