Class RequestBuilder<T extends ScimObjectNode>
java.lang.Object
de.captaingoldfish.scim.sdk.client.builder.RequestBuilder<T>
- Direct Known Subclasses:
BulkBuilder,CreateBuilder,ETagRequestBuilder,ListBuilder.GetRequestBuilder,ListBuilder.PostRequestBuilder
author Pascal Knueppel
created at: 07.12.2019 - 23:15
an abstract request builder implementation
created at: 07.12.2019 - 23:15
an abstract request builder implementation
-
Constructor Summary
ConstructorsConstructorDescriptionRequestBuilder(String baseUrl, String endpoint, Class<T> responseEntityType, ScimHttpClient scimHttpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddHeaderToRequest(Map<String, String[]> defaultHeaders, Map<String, String[]> preferredHeaders, org.apache.http.client.methods.HttpUriRequest request) adds the http headers to the current requestprotected Stringthe base url to the scim serviceprotected Stringthe resource endpoint path e.g.protected abstract org.apache.http.client.methods.HttpUriRequestbuilds the request for the serverthe headers that are expected to be returned from the server.this is the default implementation for the expected response headers that should be present within the response.the resource that should be sent to the service providerthe expected resource typeprotected ScimHttpClientan apache http client wrapper that offers some convenience methodsprotected abstract booleanisExpectedResponseCode(int httpStatus) tells this abstract class if the http status from the server is the expected success statusprotected Function<HttpResponse,Boolean> an optional method that might be used by a builder to verify if the response can be parsed into the expected resource typesends the defined request to the service providersendRequest(Map<String, String> headers) sends the defined request to the service providersendRequestWithMultiHeaders(Map<String, String[]> httpHeaders) sends the defined request to the service providerprotected RequestBuilder<T>setExpectedResponseHeaders(Map<String, String> requiredResponseHeaders) Set this if the SCIM provider is not behaving SCIM compliant by manipulating the expected headers that will be returned from the server null: The headers are checked as normally for the content-type "application/scim+json" empty map: The check of response headers is disabled filled map: The check of the response headers will be done with the entries of this mapprotected RequestBuilder<T>setResource(com.fasterxml.jackson.databind.JsonNode resource) protected RequestBuilder<T>setResource(String resource) protected ServerResponse<T>toResponse(HttpResponse response) moved into its own method to override the returned class in the list-builder that has a sub-generic type
-
Constructor Details
-
RequestBuilder
public RequestBuilder(String baseUrl, String endpoint, Class<T> responseEntityType, ScimHttpClient scimHttpClient)
-
-
Method Details
-
setResource
- Parameters:
resource- sets the resource that should be sent to the service provider
-
setResource
- Parameters:
resource- sets the resource that should be sent to the service provider
-
isExpectedResponseCode
protected abstract boolean isExpectedResponseCode(int httpStatus) tells this abstract class if the http status from the server is the expected success status- Parameters:
httpStatus- the http status from the server- Returns:
- true if the response status shows success
-
isResponseParseable
an optional method that might be used by a builder to verify if the response can be parsed into the expected resource type -
sendRequest
sends the defined request to the service provider- Returns:
- the response from the given request. A response must not be returned in any case from the service provider so the returned type is still optional
-
sendRequestWithMultiHeaders
sends the defined request to the service provider- Parameters:
httpHeaders- allows the user to add additional http headers to the request- Returns:
- the response from the given request. A response must not be returned in any case from the service provider so the returned type is still optional
-
addHeaderToRequest
protected void addHeaderToRequest(Map<String, String[]> defaultHeaders, Map<String, String[]> preferredHeaders, org.apache.http.client.methods.HttpUriRequest request) adds the http headers to the current request- Parameters:
defaultHeaders- the default http headers from theScimClientConfig. these headers will be overridden by the map fromsendRequest(Map)if duplicate keys are presentpreferredHeaders- the http headers that have been added to thesendRequest(Map)method. This map takes precedence for the default headers set in theScimClientConfigrequest- the request object to which these http headers will be added
-
sendRequest
sends the defined request to the service provider- Returns:
- the response from the given request. A response must not be returned in any case from the service provider so the returned type is still optional
-
toResponse
moved into its own method to override the returned class in the list-builder that has a sub-generic type -
getRequiredResponseHeaders
this is the default implementation for the expected response headers that should be present within the response. This is based on request since the delete request does not require a content type -
setExpectedResponseHeaders
Set this if the SCIM provider is not behaving SCIM compliant by manipulating the expected headers that will be returned from the server- null: The headers are checked as normally for the content-type "application/scim+json"
- empty map: The check of response headers is disabled
- filled map: The check of the response headers will be done with the entries of this map
- Parameters:
resource- sets the resource that should be sent to the service provider
-
getHttpUriRequest
protected abstract org.apache.http.client.methods.HttpUriRequest getHttpUriRequest()builds the request for the server -
getBaseUrl
the base url to the scim service -
getEndpoint
the resource endpoint path e.g. /Users or /Groups -
getResource
the resource that should be sent to the service provider -
getResponseEntityType
the expected resource type -
getScimHttpClient
an apache http client wrapper that offers some convenience methods -
getRequiredHttpHeaders
the headers that are expected to be returned from the server. If any of the required response headers is missing the response will be marked as not successful
-