Package com.sodius.oslc.client.requests
Class GetRootServices<T extends RootServices>
- java.lang.Object
-
- com.sodius.oslc.client.requests.AbstractResourceRequest<T>
-
- com.sodius.oslc.client.requests.GetRootServices<T>
-
- Type Parameters:
T
- the type of RootServices to extract.
- All Implemented Interfaces:
ResourceRequest<T>
,Callable<T>
public class GetRootServices<T extends RootServices> extends AbstractResourceRequest<T>
Executes a GET request to read aRootServices
instance.- Since:
- 1.1.0
-
-
Constructor Summary
Constructors Constructor Description GetRootServices(OslcClient client, URI uri, Class<T> type)
Creates a new instance to execute a GET on the specified root services location, using the given client.GetRootServices(URI uri, Class<T> type)
Creates a new instance to execute a GET on the specified root services location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClientResponse
call(OslcResource resource)
Executes the request on the specified resource.protected T
createResponse(OslcResource resource, ClientResponse response)
Processes the response obtained when executing a request on the specified resource.-
Methods inherited from class com.sodius.oslc.client.requests.AbstractResourceRequest
call, createErrorResponse, createResourceResponse, getClient, getUri
-
-
-
-
Constructor Detail
-
GetRootServices
public GetRootServices(URI uri, Class<T> type)
Creates a new instance to execute a GET on the specified root services location.- Parameters:
uri
- the root services location.type
- the type of response to extract from the request execution (usuallyRootServices
, but can be extended).
-
GetRootServices
public GetRootServices(OslcClient client, URI uri, Class<T> type)
Creates a new instance to execute a GET on the specified root services location, using the given client.The client must be
unauthenticated
, as root services is an authorization-free resource, and some servers may reject requests providing an Authorization header. The client may be customized usingOslcClientFactory
for specific parameters, like a proxy configuration.- Parameters:
client
- the client to useuri
- the root services location.type
- the type of response to extract from the request execution (usuallyRootServices
, but can be extended).- Since:
- 3.5.1
-
-
Method Detail
-
call
protected ClientResponse call(OslcResource resource)
Description copied from class:AbstractResourceRequest
Executes the request on the specified resource. Subclasses may add extra information (such as headers) on the resource before executing the request.- Specified by:
call
in classAbstractResourceRequest<T extends RootServices>
- Parameters:
resource
- the resource on which to execute a request.- Returns:
- the response of the request execution.
-
createResponse
protected T createResponse(OslcResource resource, ClientResponse response)
Description copied from class:AbstractResourceRequest
Processes the response obtained when executing a request on the specified resource. Due to the contract of theResourceRequest
interface, this method is called only when the HTTP response status is20x
.- Specified by:
createResponse
in classAbstractResourceRequest<T extends RootServices>
- 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.
-
-