Class GenHttpResponse
- java.lang.Object
-
- com.smartgridready.driver.api.http.GenHttpResponse
-
public class GenHttpResponse extends java.lang.Object
Implements a HTTP response.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getReason()
Gets the status message.java.lang.String
getResponse()
Gets the response body.int
getResponseCode()
Gets the HTTP status code.boolean
isOk()
Checks if the response is successful, depending on the status code.static GenHttpResponse
of(java.lang.String response)
Creates a new instance.static GenHttpResponse
of(java.lang.String response, int responseCode, java.lang.String reason)
Creates a new instance.
-
-
-
Method Detail
-
getResponse
public java.lang.String getResponse()
Gets the response body.- Returns:
- the response body as string
-
getResponseCode
public int getResponseCode()
Gets the HTTP status code.- Returns:
- the numeric status code
-
getReason
public java.lang.String getReason()
Gets the status message.- Returns:
- a string
-
isOk
public boolean isOk()
Checks if the response is successful, depending on the status code.- Returns:
- true if successful, false otherwise
-
of
public static GenHttpResponse of(java.lang.String response)
Creates a new instance.- Parameters:
response
- the response body- Returns:
- a new instance of
GenHttpResponse
-
of
public static GenHttpResponse of(java.lang.String response, int responseCode, java.lang.String reason)
Creates a new instance.- Parameters:
response
- the response bodyresponseCode
- the HTTP status codereason
- an optional status message- Returns:
- a new instance of
GenHttpResponse
-
-