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>

public class CreateProvisionalConsumerKey extends AbstractResourceRequest<String>

Executes a POST request to create a provisional key.

Since:
1.11.0
  • 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 services oauthRequestConsumerKeyUrl property.
      consumerName - the wanted name for the consumer
      consumerSecret - the wanted secret for the consumer
      trusted - 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 using OslcClientFactory for specific parameters, like a proxy configuration.

      Parameters:
      client - the client to use
      uri - the URI used for the underlying request, obtained from a root services oauthRequestConsumerKeyUrl property.
      consumerName - the name for the consumer, or an empty string if the client requests the server to generate one
      consumerSecret - the secret for the consumer
      trusted - 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

      protected String createResponse(OslcResource resource, ClientResponse response)
      Extract the key from the JSON payload of the response
      Specified by:
      createResponse in class AbstractResourceRequest<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

      protected ClientResponse call(OslcResource resource)
      Executes the POST request with a JSON payload created from the entity
      Specified by:
      call in class AbstractResourceRequest<String>
      Parameters:
      resource - the resource on which to execute a request.
      Returns:
      the response of the request execution.