Class ServerResponse<T extends ScimObjectNode>
- java.lang.Object
-
- de.captaingoldfish.scim.sdk.client.response.ServerResponse<T>
-
- Direct Known Subclasses:
ListBuilder.ListServerResponse
public class ServerResponse<T extends ScimObjectNode> extends Object
represents a response from the server
create at: 01.05.2020- Author:
- Pascal Knüppel
-
-
Constructor Summary
Constructors Constructor Description ServerResponse(HttpResponse httpResponse, boolean expectedResponseCode, Class<T> type, Function<HttpResponse,Boolean> isResponseParseable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ErrorResponsegetErrorResponse()will be instantiated if the response contains a scim json structure with a schemas-element that contains the valueSchemaUris.ERROR_URIMap<String,String>getHttpHeaders()the headers of the responseintgetHttpStatus()the status code of the responseTgetResource()tries to resolve the returned resource as scim object<R extends ScimObjectNode>
RgetResource(Class<R> responseType)tries to resolve the returned resource as scim objectStringgetResponseBody()the body of the responseprotected Class<T>getType()the expected response typebooleanisSuccess()if the response was succesfulbooleanisValidScimResponse()if this response is a valid scim response
-
-
-
Constructor Detail
-
ServerResponse
public ServerResponse(HttpResponse httpResponse, boolean expectedResponseCode, Class<T> type, Function<HttpResponse,Boolean> isResponseParseable)
-
-
Method Detail
-
getResource
public T getResource()
tries to resolve the returned resource as scim object- Returns:
- the parsed resource that should be returned
- Throws:
IOException- if the response body is not a valid json document
-
getResource
public <R extends ScimObjectNode> R getResource(Class<R> responseType)
tries to resolve the returned resource as scim object- Parameters:
responseType- the type of the node which might be of typeUser,Group,BulkResponseor any other type that extendsScimObjectNode- Returns:
- the parsed resource that should be returned
- Throws:
IOException- if the response body is not a valid json document
-
isValidScimResponse
public boolean isValidScimResponse()
if this response is a valid scim response
-
getErrorResponse
public ErrorResponse getErrorResponse()
will be instantiated if the response contains a scim json structure with a schemas-element that contains the valueSchemaUris.ERROR_URI
-
getResponseBody
public String getResponseBody()
the body of the response
-
getHttpStatus
public int getHttpStatus()
the status code of the response
-
isSuccess
public boolean isSuccess()
if the response was succesful
-
-