Package com.sodius.oslc.client.requests
Class CreateProvisionalConsumerKey
java.lang.Object
com.sodius.oslc.client.requests.AbstractResourceRequest<String>
com.sodius.oslc.client.requests.CreateProvisionalConsumerKey
- All Implemented Interfaces:
ResourceRequest<String>,Callable<String>
Executes a POST request to create a provisional key.
- Since:
- 1.11.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreateProvisionalConsumerKey(OslcClient client, URI uri, String consumerName, String consumerSecret, boolean trusted) Create a new instance to execute a POST on the URI provided, using the given client.CreateProvisionalConsumerKey(URI uri, String consumerName, String consumerSecret, boolean trusted) Create a new instance to execute a POST on the URI provided -
Method Summary
Modifier and TypeMethodDescriptionprotected ClientResponsecall(OslcResource resource) Executes the POST request with a JSON payload created from the entityprotected StringcreateResponse(OslcResource resource, ClientResponse response) Extract the key from the JSON payload of the responseMethods inherited from class com.sodius.oslc.client.requests.AbstractResourceRequest
call, createErrorResponse, createResourceResponse, getClient, getUri
-
Constructor Details
-
CreateProvisionalConsumerKey
public CreateProvisionalConsumerKey(URI uri, String consumerName, String consumerSecret, boolean trusted) Create a new instance to execute a POST on the URI provided- Parameters:
uri- the URI used for the underlying request, obtained from a root servicesoauthRequestConsumerKeyUrlproperty.consumerName- the wanted name for the consumerconsumerSecret- the wanted secret for the consumertrusted- true if we ask the remote application to trust our consumer at creation- See Also:
-
CreateProvisionalConsumerKey
public CreateProvisionalConsumerKey(OslcClient client, URI uri, String consumerName, String consumerSecret, boolean trusted) Create a new instance to execute a POST on the URI provided, using the given client.The client must be
unauthenticated, as requesting a consumer key doesn't necessitate an Authorization header. and some servers may reject using one. The client may be customized usingOslcClientFactoryfor specific parameters, like a proxy configuration.- Parameters:
client- the client to useuri- the URI used for the underlying request, obtained from a root servicesoauthRequestConsumerKeyUrlproperty.consumerName- the name for the consumer, or an empty string if the client requests the server to generate oneconsumerSecret- the secret for the consumertrusted- true if we ask the remote application to trust our consumer at creation- Throws:
NullPointerException- if consumerName is null or consumerSecret is null/empty- Since:
- 3.5.1
- See Also:
-
-
Method Details
-
createResponse
Extract the key from the JSON payload of the response- Specified by:
createResponsein classAbstractResourceRequest<String>- 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.
-
call
Executes the POST request with a JSON payload created from the entity- Specified by:
callin classAbstractResourceRequest<String>- Parameters:
resource- the resource on which to execute a request.- Returns:
- the response of the request execution.
-