public interface URLFetchServiceThe URLFetchService provides a way for user code to execute
HTTP requests to external URLs.
Chunked and hanging requests are not supported, and all content will be returned in a single block.
Static Fields
DEFAULT_DEADLINE_PROPERTY
public static final String DEFAULT_DEADLINE_PROPERTYSystem property for defining a global default URLFetch deadline.
| Field Value | |
|---|---|
| Type | Description |
String |
|
DEFAULT_TLS_VALIDATION_PROPERTY
public static final String DEFAULT_TLS_VALIDATION_PROPERTYSystem property to turn on server certificate validation by default. The value of the property
should be the string "true" in order to enable validation.
| Field Value | |
|---|---|
| Type | Description |
String |
|
Methods
fetch(HTTPRequest request)
public abstract HTTPResponse fetch(HTTPRequest request)Execute the specified request and return its response.
| Parameter | |
|---|---|
| Name | Description |
request |
HTTPRequestThe http request. |
| Returns | |
|---|---|
| Type | Description |
HTTPResponse |
The result of the fetch. |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
If |
fetch(URL url)
public abstract HTTPResponse fetch(URL url)Convenience method for retrieving a specific URL via a HTTP GET request with no custom headers and default values for all FetchOptions attributes. For more complex requests, use #fetch(HTTPRequest).
| Parameter | |
|---|---|
| Name | Description |
url |
URLThe url to fetch. |
| Returns | |
|---|---|
| Type | Description |
HTTPResponse |
The result of the fetch. |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
If the provided URL is malformed. |
fetchAsync(HTTPRequest request)
public abstract Future<HTTPResponse> fetchAsync(HTTPRequest request)Asynchronously execute the specified request and return its response.
| Parameter | |
|---|---|
| Name | Description |
request |
HTTPRequestThe http request. |
| Returns | |
|---|---|
| Type | Description |
Future<HTTPResponse> |
A future containing the result of the fetch, or one of the exceptions documented for #fetch(HTTPRequest). |
fetchAsync(URL url)
public abstract Future<HTTPResponse> fetchAsync(URL url)Convenience method for asynchronously retrieving a specific URL via a HTTP GET request with no custom headers and default values for all FetchOptions attributes. For more complex requests, use #fetchAsync(HTTPRequest).
| Parameter | |
|---|---|
| Name | Description |
url |
URLThe url to fetch. |
| Returns | |
|---|---|
| Type | Description |
Future<HTTPResponse> |
A future containing the result of the fetch, or one of the exceptions documented for #fetch(URL). |