SimpleResponse<T> Class
- java.
lang. Object - com.
azure. core. http. rest. SimpleResponse<T>
- com.
Type Parameters
- T
The type of the deserialized response content.
Implements
public class SimpleResponse
implements Response<T>
This class represents a simple HTTP response with a strongly-typed content. It encapsulates the HTTP request that resulted in the response, the status code of the HTTP response, the headers of the HTTP response, and the deserialized value of the HTTP response.
This class is useful when you want to work with the response of an HTTP request where the body of the response is expected to be in a specific format (the generic type T
).
Constructor Summary
Constructor | Description |
---|---|
SimpleResponse(HttpRequest request, int statusCode, HttpHeaders headers, T value) |
Creates a SimpleResponse<T>. |
SimpleResponse(Response<?> response, T value) |
Creates a SimpleResponse<T> from a response and a value. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Http |
getHeaders()
Gets the headers from the HTTP response. |
Http |
getRequest()
Gets the request which resulted in this SimpleResponse<T>. |
int |
getStatusCode()
Gets the status code of the HTTP response. |
T |
getValue()
Gets the deserialized value of the HTTP response. |
Methods inherited from java.lang.Object
Constructor Details
SimpleResponse
public SimpleResponse(HttpRequest request, int statusCode, HttpHeaders headers, T value)
Creates a SimpleResponse<T>.
Parameters:
SimpleResponse
public SimpleResponse(Response response, T value)
Creates a SimpleResponse<T> from a response and a value.
Parameters:
Method Details
getHeaders
public HttpHeaders getHeaders()
Gets the headers from the HTTP response.
getRequest
public HttpRequest getRequest()
Gets the request which resulted in this SimpleResponse<T>.
Returns:
getStatusCode
public int getStatusCode()
Gets the status code of the HTTP response.
Returns:
getValue
public T getValue()
Gets the deserialized value of the HTTP response.
Returns:
Applies to
Azure SDK for Java