public abstract static class ProxiedResource.NodeResponse<ResponseType> extends Object
| Constructor and Description |
|---|
NodeResponse() |
| Modifier and Type | Method and Description |
|---|---|
Object |
body()
Convenience method that returns either the body of a successful request or if that one is
null,
it returns the error body. |
abstract int |
code()
Returns the HTTP status code of the response.
|
static <ResponseType> |
create(boolean isSuccess,
int code,
ResponseType entity,
byte[] error) |
abstract Optional<ResponseType> |
entity()
Returns the typed response object if the request was successful.
|
abstract Optional<byte[]> |
error()
Returns the error response if the request wasn't successful.
|
String |
errorText() |
abstract boolean |
isSuccess()
Indicates whether the request has been successful or not.
|
public abstract boolean isSuccess()
true for a successful request, false otherwisepublic abstract int code()
public abstract Optional<ResponseType> entity()
Optional.Optionalpublic abstract Optional<byte[]> error()
Optional.Optionalpublic Object body()
null,
it returns the error body.
Use entity() the get the typed response object. (only available if isSuccess() is true)
public static <ResponseType> ProxiedResource.NodeResponse<ResponseType> create(boolean isSuccess, int code, @Nullable ResponseType entity, @Nullable byte[] error)
Copyright © 2012–2021 Graylog, Inc.. All rights reserved.