com.google.appengine.api.urlfetch

## Interface URLFetchService

-     public interface URLFetchService

  The `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.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HTTPResponse` | `fetch(HTTPRequest request)` Execute the specified request and return its response.
    `HTTPResponse` | `fetch(java.net.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.
    `java.util.concurrent.Future<HTTPResponse>` | `fetchAsync(HTTPRequest request)` Asynchronously execute the specified request and return its response.
    `java.util.concurrent.Future<HTTPResponse>` | `fetchAsync(java.net.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.

- - ### Method Detail

    - #### fetch

          HTTPResponse fetch(java.net.URL url)
                             throws java.io.IOException

      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)`.
      Parameters:
        `url` - The url to fetch.
      Returns:
        The result of the fetch.
      Throws:
        `java.net.MalformedURLException` - If the provided URL is malformed.
        `java.io.IOException` - If the remote service could not be contacted or the URL could not be fetched.
        `SocketTimeoutException` - If the request takes too long to respond.
        `ResponseTooLargeException` - If the response is too large.
        `javax.net.ssl.SSLHandshakeException` - If the server's SSL certificate could not be validated and validation was requested.

    - #### fetch

          HTTPResponse fetch(HTTPRequest request)
                             throws java.io.IOException

      Execute the specified request and return its response.
      Parameters:
        `request` - The http request.
      Returns:
        The result of the fetch.
      Throws:
        `java.lang.IllegalArgumentException` - If `request.getMethod` is not supported by the `URLFetchService`.
        `java.net.MalformedURLException` - If the provided URL is malformed.
        `java.io.IOException` - If the remote service could not be contacted or the URL could not be fetched.
        `SocketTimeoutException` - If the request takes too long to respond.
        `ResponseTooLargeException` - If response truncation has been disabled via the `FetchOptions` object on `request` and the response is too large. Some responses are too large to even retrieve from the remote server, and in these cases the exception is thrown even if response truncation is enabled.
        `javax.net.ssl.SSLHandshakeException` - If the server's SSL certificate could not be validated and validation was requested.

    - #### fetchAsync

          java.util.concurrent.Future<HTTPResponse> fetchAsync(java.net.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)`.
      Parameters:
        `url` - The url to fetch.
      Returns:
        A future containing the result of the fetch, or one of the exceptions documented for `fetch(URL)`.

    - #### fetchAsync

          java.util.concurrent.Future<HTTPResponse> fetchAsync(HTTPRequest request)

      Asynchronously execute the specified request and return its response.
      Parameters:
        `request` - The http request.
      Returns:
        A future containing the result of the fetch, or one of the exceptions documented for `fetch(HTTPRequest)`.