Package org.imixs.workflow.services.rest
Class RestClient
java.lang.Object
org.imixs.workflow.services.rest.RestClient
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.
- Author:
- Ralph Soika
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the content of a GET request from a Rest Service URI Endpoint.int
This method returns the last HTTP ResultPosts a byte array to a Rest Service URI Endpoint.Posts a byte array to a Rest Service URI Endpoint.Posts a String data object with a specific Content-Type to a Rest Service URI Endpoint.Posts a String data object with a specific Content-Type to a Rest Service URI Endpoint.void
registerRequestFilter
(RequestFilter filter) Register a ClientRequestFilter instance.void
setEncoding
(String aEncoding) void
setRequestProperty
(String key, String value) Set a single header request property
-
Field Details
-
requestFilterList
-
-
Constructor Details
-
RestClient
public RestClient() -
RestClient
-
-
Method Details
-
registerRequestFilter
Register a ClientRequestFilter instance.- Parameters:
filter
- - request filter instance.
-
getEncoding
-
setEncoding
-
getServiceEndpoint
-
setRequestProperty
Set a single header request property -
post
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.
- Parameters:
uri
- - Rest Endpoint URIdataString
- - contentcontentType
- - request MediaType- Returns:
- content
- Throws:
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.
- Parameters:
uri
- - Rest Endpoint URIdataString
- - contentcontentType
- - request MediaTypeacceptType
- - accept MediaType- Returns:
- content
- Throws:
RestAPIException
-
post
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.
- Parameters:
uri
- - Rest Endpoint URIdata
- - contentcontentType
- - request MediaTypeacceptType
- - accept MediaType- Returns:
- content
- Throws:
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.
- Parameters:
uri
- - Rest Endpoint URIdata
- - contentcontentType
- - request MediaTypeacceptType
- - accept MediaType- Returns:
- content
- Throws:
RestAPIException
-
getLastHTTPResult
public int getLastHTTPResult()This method returns the last HTTP Result- Returns:
-
get
Gets the content of a GET request from a Rest Service URI Endpoint. I case of an error the method throws a RestAPIException.- Parameters:
uri
- - Rest Endpoint RUI- Returns:
- - content or null if no content is available.
- Throws:
RestAPIException
-