public class

Request

extends Object
java.lang.Object
   ↳ com.urbanairship.http.Request

Class Overview

Http request wrapper.

Summary

Fields
protected String body
protected String contentType
protected String password
protected String requestMethod
protected final Map<StringString> responseProperties
protected URL url
protected String user
Public Constructors
Request(String requestMethod, URL url)
Request constructor.
Public Methods
Response execute()
Executes the request.
static String getUrbanAirshipUserAgent()
Gets the Urban Airship User Agent used for any Urban Airship requests.
Request setCompressRequestBody(boolean compressRequestBody)
Sets whether the request body is compressed with gzip.
Request setCredentials(String user, String password)
Sets the credentials.
Request setHeader(String key, String value)
Set additional request properties.
Request setIfModifiedSince(long timeMS)
Sets the if modified since value.
Request setRequestBody(String body, String contentType)
Sets the request body.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected String body

protected String contentType

protected String password

protected String requestMethod

protected final Map<StringString> responseProperties

protected URL url

protected String user

Public Constructors

public Request (String requestMethod, URL url)

Request constructor.

Parameters
requestMethod The string request method.
url The request URL.

Public Methods

public Response execute ()

Executes the request.

Returns
  • The request response.

public static String getUrbanAirshipUserAgent ()

Gets the Urban Airship User Agent used for any Urban Airship requests.

Returns
  • The Urban Airship User Agent.

public Request setCompressRequestBody (boolean compressRequestBody)

Sets whether the request body is compressed with gzip.

Parameters
compressRequestBody A boolean to compress the request body.
Returns
  • The request.

public Request setCredentials (String user, String password)

Sets the credentials.

Parameters
user The user ID.
password The user token.
Returns
  • The request.

public Request setHeader (String key, String value)

Set additional request properties.

The credentials and content type will also be added. The credentials can be set with setCredentials(String, String) and the content type can be set with setRequestBody(String, String).

Parameters
key The property.
value The value of the property.
Returns
  • The request.

public Request setIfModifiedSince (long timeMS)

Sets the if modified since value.

Parameters
timeMS The time in milliseconds.
Returns
  • The request.

public Request setRequestBody (String body, String contentType)

Sets the request body.

Parameters
body The string body.
contentType The string content type.
Returns
  • The request.