HTTPRequest (Google App Engine API for Java)

com.google.appengine.api.urlfetch

Class HTTPRequest

  • java.lang.Object
    • com.google.appengine.api.urlfetch.HTTPRequest
  • All Implemented Interfaces:
    java.io.Serializable


    public class HTTPRequest
    extends java.lang.Object
    implements java.io.Serializable
    HTTPRequest encapsulates a single HTTP request that is made via the URLFetchService.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HTTPRequest(java.net.URL url)
      Creates a HTTPRequest that represents a GET request to the specified URL.
      HTTPRequest(java.net.URL url, HTTPMethod method)
      Creates a HTTPRequest that represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc).
      HTTPRequest(java.net.URL url, HTTPMethod method, FetchOptions fetchOptions)
      Creates a HTTPRequest that represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc) and the specified FetchOptions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addHeader(HTTPHeader header)
      Adds header to this request.
      FetchOptions getFetchOptions()
      Get the fetch options for this request.
      java.util.List<HTTPHeader> getHeaders()
      Returns an immutable List of HTTPHeader objects that have been added to this request.
      HTTPMethod getMethod()
      Gets the HTTP method for this request (GET, POST, etc).
      byte[] getPayload()
      Gets the payload (such as POST body) for this request.
      java.net.URL getURL()
      Gets the URL for this request.
      void setHeader(HTTPHeader header)
      Sets an HTTPHeader for this request.
      void setPayload(byte[] payload)
      Sets the payload for this request.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTTPRequest

        public HTTPRequest(java.net.URL url)
        Creates a HTTPRequest that represents a GET request to the specified URL.
      • HTTPRequest

        public HTTPRequest(java.net.URL url,
                           HTTPMethod method)
        Creates a HTTPRequest that represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc).
      • HTTPRequest

        public HTTPRequest(java.net.URL url,
                           HTTPMethod method,
                           FetchOptions fetchOptions)
        Creates a HTTPRequest that represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc) and the specified FetchOptions.
    • Method Detail

      • getMethod

        public HTTPMethod getMethod()
        Gets the HTTP method for this request (GET, POST, etc).
      • getURL

        public java.net.URL getURL()
        Gets the URL for this request.
      • getPayload

        public byte[] getPayload()
        Gets the payload (such as POST body) for this request. Certain HTTP methods (e.g. GET) will not have any payload, and this method will return null.
      • setPayload

        public void setPayload(byte[] payload)
        Sets the payload for this request. This method should not be called for certain HTTP methods (e.g. GET).
      • addHeader

        public void addHeader(HTTPHeader header)
        Adds header to this request. If an HTTPHeader with the same name already exists for this request, it's values are merged with header.
        Parameters:
        header - a not null HTTPHeader
      • setHeader

        public void setHeader(HTTPHeader header)
        Sets an HTTPHeader for this request. If an HTTPHeader with the same name already exists, its value is replaced.
      • getHeaders

        public java.util.List<HTTPHeader> getHeaders()
        Returns an immutable List of HTTPHeader objects that have been added to this request.
      • getFetchOptions

        public FetchOptions getFetchOptions()
        Get the fetch options for this request.

Send feedback about...