Class HttpClientFacade
java.lang.Object
org.eclipse.dirigible.api.v3.http.HttpClientFacade
- All Implemented Interfaces:
IScriptingFacade
public class HttpClientFacade extends Object implements IScriptingFacade
Java face for HTTP operations.
-
Constructor Summary
Constructors Constructor Description HttpClientFacade() -
Method Summary
Modifier and Type Method Description static org.apache.http.client.methods.HttpDeletecreateDeleteRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP DELETE Request.static org.apache.http.client.methods.HttpGetcreateGetRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP GET Request.static org.apache.http.client.methods.HttpHeadcreateHeadRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP HEAD Request.static org.apache.http.client.methods.HttpPatchcreatePatchRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP PATCH Request.static org.apache.http.client.methods.HttpPostcreatePostRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP POST Request.static org.apache.http.client.methods.HttpPutcreatePutRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP PUT Request.static org.apache.http.client.methods.HttpTracecreateTraceRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP TRACE Request.static Stringdelete(String url, String options)Performs a DELETE request for the specified URL and options.static Stringget(String url, String options)Performs a GET request for the specified URL and options.static Stringhead(String url, String options)Performs a HEAD request for the specified URL and options.static HttpClientRequestOptionsparseOptions(String options)Parse HTTP Request Options.static Stringpatch(String url, String options)Performs a PATCH request for the specified URL and options.static Stringpost(String url, String options)Performs a POST request for the specified URL and options.static org.apache.http.client.config.RequestConfigprepareConfig(String httpClientRequestOptions)Prepare HTTP Request Configurations.static org.apache.http.client.config.RequestConfigprepareConfig(HttpClientRequestOptions httpClientRequestOptions)Prepare HTTP Request Configurations.static HttpClientResponseprocessHttpClientResponse(org.apache.http.client.methods.CloseableHttpResponse response, boolean binary)Process http client response.static Stringput(String url, String options)Performs a PUT request for the specified URL and options.static Stringtrace(String url, String options)Performs a TRACE request for the specified URL and options.
-
Constructor Details
-
HttpClientFacade
public HttpClientFacade()
-
-
Method Details
-
get
Performs a GET request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- In case an I/O exception occurs
-
post
Performs a POST request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- In case an I/O exception occurs
-
put
Performs a PUT request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- Signals that an I/O exception has occurred.
-
patch
Performs a PATCH request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- Signals that an I/O exception has occurred.
-
delete
Performs a DELETE request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- In case an I/O exception occurs
-
head
Performs a HEAD request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- In case an I/O exception occurs
-
trace
Performs a TRACE request for the specified URL and options.- Parameters:
url- the URLoptions- the options- Returns:
- the response as JSON
- Throws:
IOException- In case an I/O exception occurs
-
processHttpClientResponse
public static HttpClientResponse processHttpClientResponse(org.apache.http.client.methods.CloseableHttpResponse response, boolean binary) throws IOExceptionProcess http client response.- Parameters:
response- the responsebinary- the binary- Returns:
- the http client response
- Throws:
IOException- Signals that an I/O exception has occurred.
-
parseOptions
Parse HTTP Request Options.- Parameters:
options- the options- Returns:
- the http client request options
-
prepareConfig
public static org.apache.http.client.config.RequestConfig prepareConfig(String httpClientRequestOptions)Prepare HTTP Request Configurations.- Parameters:
httpClientRequestOptions- the http client request options- Returns:
- the request config
-
prepareConfig
public static org.apache.http.client.config.RequestConfig prepareConfig(HttpClientRequestOptions httpClientRequestOptions)Prepare HTTP Request Configurations.- Parameters:
httpClientRequestOptions- the http client request options- Returns:
- the request config
-
createGetRequest
public static org.apache.http.client.methods.HttpGet createGetRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP GET Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http get
-
createPostRequest
public static final org.apache.http.client.methods.HttpPost createPostRequest(String url, HttpClientRequestOptions httpClientRequestOptions) throws IOExceptionBuild HTTP POST Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http post
- Throws:
IOException- Signals that an I/O exception has occurred.
-
createPutRequest
public static final org.apache.http.client.methods.HttpPut createPutRequest(String url, HttpClientRequestOptions httpClientRequestOptions) throws IOExceptionBuild HTTP PUT Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http put
- Throws:
IOException- Signals that an I/O exception has occurred.
-
createPatchRequest
public static final org.apache.http.client.methods.HttpPatch createPatchRequest(String url, HttpClientRequestOptions httpClientRequestOptions) throws IOExceptionBuild HTTP PATCH Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http patch
- Throws:
IOException- Signals that an I/O exception has occurred.
-
createDeleteRequest
public static org.apache.http.client.methods.HttpDelete createDeleteRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP DELETE Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http delete
-
createHeadRequest
public static org.apache.http.client.methods.HttpHead createHeadRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP HEAD Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http head
-
createTraceRequest
public static org.apache.http.client.methods.HttpTrace createTraceRequest(String url, HttpClientRequestOptions httpClientRequestOptions)Build HTTP TRACE Request.- Parameters:
url- the urlhttpClientRequestOptions- the http client request options- Returns:
- the http trace
-