Package com.logicaldoc.core.automation
Class HttpTool
java.lang.Object
com.logicaldoc.core.automation.HttpTool
Utility methods to call URLs
- Since:
- 9.2
- Author:
- Marco Meschieri - LogicalDOC
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionDownloads a file from a URLdownload(String url, Map<String, String> headers, Map<String, org.apache.hc.client5.http.entity.mime.AbstractContentBody> parts, int timeout) Downloads a file received in answer to a multipart POST requestCalls the provided URL with an HTTP GET requestCalls the provided URL with an HTTP POST requestSends a HTTP POST request containing a urlencoded formpostMultipart(String url, Map<String, String> headers, Map<String, org.apache.hc.client5.http.entity.mime.AbstractContentBody> parts, int timeout) Sends a HTTP POST with multiple parts
- 
Constructor Details- 
HttpToolpublic HttpTool()
 
- 
- 
Method Details- 
getCalls the provided URL with an HTTP GET request- Parameters:
- url- The URL to call
- headers- Optional map of headers
- timeout- Timeout in seconds
- Returns:
- The response body
 
- 
downloadDownloads a file from a URL- Parameters:
- url- The URL to call
- headers- Optional map of headers
- timeout- Timeout in seconds
- Returns:
- The downloaded file, this is a temporary file, remember to delete it when done
 
- 
postCalls the provided URL with an HTTP POST request- Parameters:
- url- The URL to call
- headers- Optional map of headers
- entity- Body of the POST request
- timeout- Timeout in seconds
- Returns:
- The response body
 
- 
postFormpublic String postForm(String url, Map<String, String> headers, Map<String, String> fields, int timeout) Sends a HTTP POST request containing a urlencoded form- Parameters:
- url- The URL to call
- headers- Optional map of headers
- fields- The fields of the form
- timeout- Timeout in seconds
- Returns:
- The response body
 
- 
postMultipartpublic String postMultipart(String url, Map<String, String> headers, Map<String, org.apache.hc.client5.http.entity.mime.AbstractContentBody> parts, int timeout) Sends a HTTP POST with multiple parts- Parameters:
- url- The URL to call
- headers- Optional map of headers
- parts- Map of the parts
- timeout- Timeout in seconds
- Returns:
- The response body
 
- 
downloadpublic File download(String url, Map<String, String> headers, Map<String, org.apache.hc.client5.http.entity.mime.AbstractContentBody> parts, int timeout) Downloads a file received in answer to a multipart POST request- Parameters:
- url- The URL to call
- headers- Optional map of headers
- parts- Map of the parts
- timeout- Timeout in seconds
- Returns:
- The downloaded file, this is a temporary file, remember to delete it when done
 
 
-