HttpResponse Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.provisioning.device.transport.https.HttpResponse

public class HttpResponse

An HTTPS response. Contains the status code, body, header fields, and error reason (if any).

Constructor Summary

Constructor Description
HttpResponse()
HttpResponse(int status, byte[] body, Map<String, List<String>> headerFields, byte[] errorReason)

Constructor.

Method Summary

Modifier and Type Method and Description
byte [] getBody()

Getter for the response body.

byte [] getErrorReason()

Getter for the error reason.

String getHeaderField(String field)

Getter for a header field.

Map<String, String> getHeaderFields()

Getter for the header fields.

int getStatus()

Getter for the HTTPS status code.

boolean isFieldAvailable(String field)

Constructor Details

HttpResponse

protected HttpResponse()

HttpResponse

public HttpResponse(int status, byte[] body, Map> headerFields, byte[] errorReason)

Constructor.

Parameters:

status - The HTTPS status code.
body - The response body.
headerFields - The map of header field names and the values associated with the field name.
errorReason - The error reason.

Method Details

getBody

public byte [] getBody()

Getter for the response body.

Returns:

The response body.

getErrorReason

public byte [] getErrorReason()

Getter for the error reason.

Returns:

The error reason.

getHeaderField

public String getHeaderField(String field)

Getter for a header field.

Parameters:

field - the header field name.

Returns:

the header field value. If multiple values are present, they are returned as a comma-separated list according to RFC2616.

Throws:

IllegalArgumentException - if no value exists for the given field name.

getHeaderFields

public Map getHeaderFields()

Getter for the header fields.

Returns:

The copy of the header fields for this response.

getStatus

public int getStatus()

Getter for the HTTPS status code.

Returns:

The HTTPS status code.

isFieldAvailable

public boolean isFieldAvailable(String field)

Parameters:

field

Applies to