Class NetHttpRequest

java.lang.Object
com.google.api.client.http.LowLevelHttpRequest
com.google.api.client.http.javanet.NetHttpRequest

final class NetHttpRequest extends LowLevelHttpRequest
  • Field Details

  • Constructor Details

    • NetHttpRequest

      NetHttpRequest(HttpURLConnection connection)
      Parameters:
      connection - HTTP URL connection
  • Method Details

    • addHeader

      public void addHeader(String name, String value)
      Description copied from class: LowLevelHttpRequest
      Adds a header to the HTTP request.

      Note that multiple headers of the same name need to be supported, in which case LowLevelHttpRequest.addHeader(String, String) will be called for each instance of the header.

      Specified by:
      addHeader in class LowLevelHttpRequest
      Parameters:
      name - header name
      value - header value
    • setTimeout

      public void setTimeout(int connectTimeout, int readTimeout)
      Description copied from class: LowLevelHttpRequest
      Sets the connection and read timeouts.

      Default implementation does nothing, but subclasses should normally override.

      Overrides:
      setTimeout in class LowLevelHttpRequest
      Parameters:
      connectTimeout - timeout in milliseconds to establish a connection or 0 for an infinite timeout
      readTimeout - Timeout in milliseconds to read data from an established connection or 0 for an infinite timeout
    • execute

      public LowLevelHttpResponse execute() throws IOException
      Description copied from class: LowLevelHttpRequest
      Executes the request and returns a low-level HTTP response object.
      Specified by:
      execute in class LowLevelHttpRequest
      Throws:
      IOException