Class HTTPRequest
java.lang.Object
com.google.appengine.api.urlfetch.HTTPRequest
- All Implemented Interfaces:
Serializable
HTTPRequest encapsulates a single HTTP request that is made
via the URLFetchService.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHTTPRequest(URL url) Creates aHTTPRequestthat represents a GET request to the specified URL.HTTPRequest(URL url, HTTPMethod method) Creates aHTTPRequestthat represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc).HTTPRequest(URL url, HTTPMethod method, FetchOptions fetchOptions) Creates aHTTPRequestthat represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc) and the specifiedFetchOptions. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHeader(HTTPHeader header) Addsheaderto this request.Get the fetch options for this request.Returns an immutableListofHTTPHeaderobjects that have been added to this request.Gets the HTTP method for this request (GET, POST, etc).byte @Nullable []Gets the payload (such as POST body) for this request.getURL()Gets the URL for this request.voidsetHeader(HTTPHeader header) Sets anHTTPHeaderfor this request.voidsetPayload(byte[] payload) Sets the payload for this request.
-
Constructor Details
-
HTTPRequest
Creates aHTTPRequestthat represents a GET request to the specified URL. -
HTTPRequest
Creates aHTTPRequestthat represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc). -
HTTPRequest
Creates aHTTPRequestthat represents an HTTP request to the specified URL with the specified HTTP method (GET, POST, etc) and the specifiedFetchOptions.
-
-
Method Details
-
getMethod
Gets the HTTP method for this request (GET, POST, etc). -
getURL
Gets the URL for this request. -
getPayload
public byte @Nullable [] 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
Addsheaderto this request. If anHTTPHeaderwith the samenamealready exists for this request, it's values are merged withheader.- Parameters:
header- a notnullHTTPHeader
-
setHeader
Sets anHTTPHeaderfor this request. If anHTTPHeaderwith the samenamealready exists, its value is replaced. -
getHeaders
Returns an immutableListofHTTPHeaderobjects that have been added to this request. -
getFetchOptions
Get the fetch options for this request.
-