public static class SimpleRestClient.Response extends Object
| Modifier and Type | Method and Description |
|---|---|
<T> Optional<T> |
as(Class<T> targetType,
int... validResponseCodes)
Tries to parse the returned content into the specified target type.
|
byte[] |
asBytes(int... validResponseCodes)
Reads the response as byte array if the response represents is valid (by response code)
|
InputStream |
asInputStream(int... validResponseCodes)
Reads the response as InputStream if the response represents is valid (by response code)
|
String |
asString(int... validResponseCodes)
Reads the response as String if the response represents is valid (by response code)
|
String |
getMessage()
The HTTP repsonse message
|
int |
getStatusCode()
The http response code
|
boolean |
hasValidResponseCode(int... validResponseCodes)
Checks if the response code returned by the server is one of the valid response code provided.
|
public int getStatusCode()
public String getMessage()
public boolean hasValidResponseCode(int... validResponseCodes)
throws IOException
IllegalStateException is
thrown.validResponseCodes - list of valid response codesIOExceptionpublic InputStream asInputStream(int... validResponseCodes)
validResponseCodes - the response codes that denote the response as validpublic String asString(int... validResponseCodes)
validResponseCodes - the response codes that denote the response as validpublic byte[] asBytes(int... validResponseCodes)
validResponseCodes - the response codes that denote the response as validpublic <T> Optional<T> as(Class<T> targetType, int... validResponseCodes)
EntityReader must be provided via ServiceLoader
that supports the received content-type and data.T - targetType - the target type to which the received data should be marshalledEntityReaderCopyright © 2017–2018 DevCon5 GmbH. All rights reserved.