Klasse RestClient

java.lang.Object
org.imixs.workflow.services.rest.RestClient

public class RestClient extends Object
The Imixs RestClient is a helper class for a Rest based communication without the use of Jax-rs.

The Imixs RestClient provides methods to GET and POST data objects.

The client throws a RestAPIException in case of an communication error.

For a convinient way to access the Imixs-Rest API use the Imixs-Melman project on Github.

Autor:
Ralph Soika
  • Felddetails

  • Konstruktordetails

    • RestClient

      public RestClient()
    • RestClient

      public RestClient(String rootURL)
  • Methodendetails

    • registerRequestFilter

      public void registerRequestFilter(RequestFilter filter)
      Register a ClientRequestFilter instance.
      Parameter:
      filter - - request filter instance.
    • getEncoding

      public String getEncoding()
    • setEncoding

      public void setEncoding(String aEncoding)
    • getServiceEndpoint

      public String getServiceEndpoint()
    • setRequestProperty

      public void setRequestProperty(String key, String value)
      Set a single header request property
    • post

      public String post(String uri, String dataString, String contentType) throws RestAPIException
      Posts a String data object with a specific Content-Type to a Rest Service URI Endpoint. This method can be used to simulate different post scenarios.

      The parameter 'contnetType' can be used to request a specific media type.

      Parameter:
      uri - - Rest Endpoint URI
      dataString - - content
      contentType - - request MediaType
      Gibt zurück:
      content
      Löst aus:
      RestAPIException
      Exception
    • post

      public String post(String uri, String dataString, String _contentType, String acceptType) throws RestAPIException
      Posts a String data object with a specific Content-Type to a Rest Service URI Endpoint. This method can be used to simulate different post scenarios.

      The parameter 'contnetType' and 'acceptType' can be used to request and accept specific media types.

      Parameter:
      uri - - Rest Endpoint URI
      dataString - - content
      acceptType - - accept MediaType
      contentType - - request MediaType
      Gibt zurück:
      content
      Löst aus:
      RestAPIException
    • post

      public String post(String uri, byte[] data, String _contentType) throws RestAPIException
      Posts a byte array to a Rest Service URI Endpoint. This method can be used to simulate different post scenarios.

      The parameter 'contnetType' and 'acceptType' can be used to request and accept specific media types.

      Parameter:
      uri - - Rest Endpoint URI
      data - - content
      contentType - - request MediaType
      acceptType - - accept MediaType
      Gibt zurück:
      content
      Löst aus:
      RestAPIException
    • post

      public String post(String uri, byte[] data, String _contentType, String acceptType) throws RestAPIException
      Posts a byte array to a Rest Service URI Endpoint. This method can be used to simulate different post scenarios.

      The parameter 'contnetType' and 'acceptType' can be used to request and accept specific media types.

      Parameter:
      uri - - Rest Endpoint URI
      data - - content
      acceptType - - accept MediaType
      contentType - - request MediaType
      Gibt zurück:
      content
      Löst aus:
      RestAPIException
    • getLastHTTPResult

      public int getLastHTTPResult()
      This method returns the last HTTP Result
      Gibt zurück:
    • get

      public String get(String uri) throws RestAPIException
      Gets the content of a GET request from a Rest Service URI Endpoint. I case of an error the method throws a RestAPIException.
      Parameter:
      uri - - Rest Endpoint RUI
      Gibt zurück:
      - content or null if no content is available.
      Löst aus:
      RestAPIException