com.github.kristofa.test.http.client
Interface HttpClientResponse<T>

Type Parameters:
T - Type for response entity.

public interface HttpClientResponse<T>

Http Response as being returned by a HttpClient. Provides the user with the HTTP response code, response entity and optional error message.

IMPORTANT: Call close() method when done with process response. This will clean-up resources.

Author:
kristof

Method Summary
 void close()
          Closes all resources related to this request/response.
 String getContentType()
          Get Content-Type.
 String getErrorMessage()
          In case request failed this will return the error message.
 int getHttpCode()
          Gets the HTTP return code.
 T getResponseEntity()
          Gets response object as a result of executing http request.
 boolean success()
          Indicates if result of http request was successful.
 

Method Detail

success

boolean success()
Indicates if result of http request was successful. Response was successful in case there is no error message.

Returns:
true in case request was successful, false in case request failed.

getHttpCode

int getHttpCode()
Gets the HTTP return code.

Returns:
the httpCode

getErrorMessage

String getErrorMessage()
In case request failed this will return the error message.

Returns:
the error message. Will be null in case request was successful.

getResponseEntity

T getResponseEntity()
Gets response object as a result of executing http request.

Returns:
the response Response as a result of executing http request.

close

void close()
Closes all resources related to this request/response.


getContentType

String getContentType()
Get Content-Type.

Returns:
Content-Type.


Copyright © 2014. All Rights Reserved.