Package com.sodius.oslc.client.requests
Class GetServiceProvider
- java.lang.Object
-
- com.sodius.oslc.client.requests.AbstractResourceRequest<ResourceResponse<T>>
-
- com.sodius.oslc.client.requests.GetResource<ServiceProvider>
-
- com.sodius.oslc.client.requests.GetServiceProvider
-
- All Implemented Interfaces:
ResourceRequest<ResourceResponse<ServiceProvider>>
,Callable<ResourceResponse<ServiceProvider>>
public class GetServiceProvider extends GetResource<ServiceProvider>
Executes a GET request to read aServiceProvider
instance.The service provider URI is usually given by a
ServiceProviderCatalog
.- Since:
- 1.1.0
- See Also:
GetServiceProviderCatalog
-
-
Constructor Summary
Constructors Constructor Description GetServiceProvider(OslcClient client, URI uri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ResourceResponse<ServiceProvider>
createErrorResponse(OslcResource resource, ClientResponse response)
Processes the error response obtained when executing a request on the specified resource.protected ResourceResponse<ServiceProvider>
createResponse(OslcResource resource, ClientResponse response)
Extracts aResourceResponse
instance from the obtained HTTP response.-
Methods inherited from class com.sodius.oslc.client.requests.GetResource
call, get
-
Methods inherited from class com.sodius.oslc.client.requests.AbstractResourceRequest
call, createResourceResponse, getClient, getUri
-
-
-
-
Constructor Detail
-
GetServiceProvider
public GetServiceProvider(OslcClient client, URI uri)
-
-
Method Detail
-
createResponse
protected ResourceResponse<ServiceProvider> createResponse(OslcResource resource, ClientResponse response)
Description copied from class:GetResource
Extracts aResourceResponse
instance from the obtained HTTP response. The response contains the response headers, from which theETag
header can be extracted in case this request is to follow by aPUT
.- Overrides:
createResponse
in classGetResource<ServiceProvider>
- Parameters:
resource
- the resource on which a request is executed.response
- the response obtained.- Returns:
- the extraction of the response content into the expected format.
-
createErrorResponse
protected ResourceResponse<ServiceProvider> createErrorResponse(OslcResource resource, ClientResponse response)
Description copied from class:AbstractResourceRequest
Processes the error response obtained when executing a request on the specified resource. Due to the contract of theResourceRequest
interface, this method is called when the HTTP response status is anything but20x
.The default implementation raises a
ClientWebException
. Subclasses may override for example to return a default entity instead of throwing an exception.- Overrides:
createErrorResponse
in classAbstractResourceRequest<ResourceResponse<ServiceProvider>>
- Parameters:
resource
- the resource on which a request is executed.response
- the error response obtained.- Returns:
- a default entity or an entity extracted from the error response, if any.
-
-