Example usage for com.amazonaws.http ExecutionContext setSigner

List of usage examples for com.amazonaws.http ExecutionContext setSigner

Introduction

In this page you can find the example usage for com.amazonaws.http ExecutionContext setSigner.

Prototype

@Deprecated
public void setSigner(Signer signer) 

Source Link

Document

There is in general no need to set the signer in the execution context, since the signer for each request may differ depending on the URI of the request.

Usage

From source file:com.ivona.services.tts.IvonaSpeechCloudClient.java

License:Open Source License

private <Y> Request<Y> prepareRequest(Request<Y> request, ExecutionContext executionContext,
        boolean signRequest) {
    request.setEndpoint(endpoint);//  ww w.  j  av  a 2 s  . co  m
    request.setTimeOffset(timeOffset);

    AWSCredentials credentials = awsCredentialsProvider.getCredentials();

    AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
    if (originalRequest != null && originalRequest.getRequestCredentials() != null) {
        credentials = originalRequest.getRequestCredentials();
    }
    if (signRequest) {
        // expiration date is not currently supported on service side, but presignRequest method requires
        // this argument so one with default value is provided.
        Date expirationDate = DateTime.now(DateTimeZone.UTC).plusMinutes(DEFAULT_GET_REQUEST_EXPIRATION_MINUTES)
                .toDate();
        signer.presignRequest(request, credentials, expirationDate);
    } else {
        executionContext.setSigner(signer);
        executionContext.setCredentials(credentials);
    }
    return request;
}