/** * Convenience method to set the {@link #protocol()}, {@link #host()}, {@link #port()}, and * {@link #encodedPath()} from a {@link URI} object. * * @param uri URI containing protocol, host, port and path. * @return This builder for method chaining. */ @Override default Builder uri(URI uri) { return this.protocol(uri.getScheme()) .host(uri.getHost()) .port(uri.getPort()) .encodedPath(SdkHttpUtils.appendUri(uri.getRawPath(), encodedPath())); }
/** * Convenience method to set the {@link #protocol()}, {@link #host()}, {@link #port()}, and * {@link #encodedPath()} from a {@link URI} object. * * @param uri URI containing protocol, host, port and path. * @return This builder for method chaining. */ @Override default Builder uri(URI uri) { return this.protocol(uri.getScheme()) .host(uri.getHost()) .port(uri.getPort()) .encodedPath(SdkHttpUtils.appendUri(uri.getRawPath(), encodedPath())); }
/** * Step 1 of the AWS Signature version 4 calculation. Refer to * http://docs.aws * .amazon.com/general/latest/gr/sigv4-create-canonical-request.html to * generate the canonical request. */ private String createCanonicalRequest(SdkHttpFullRequest.Builder request, String contentSha256, boolean doubleUrlEncode) { String canonicalRequest = request.method().toString() + SignerConstant.LINE_SEPARATOR + // This would optionally double url-encode the resource path getCanonicalizedResourcePath(request.encodedPath(), doubleUrlEncode) + SignerConstant.LINE_SEPARATOR + getCanonicalizedQueryString(request.rawQueryParameters()) + SignerConstant.LINE_SEPARATOR + getCanonicalizedHeaderString(request.headers()) + SignerConstant.LINE_SEPARATOR + getSignedHeadersString(request.headers()) + SignerConstant.LINE_SEPARATOR + contentSha256; LOG.trace(() -> "AWS4 Canonical Request: " + canonicalRequest); return canonicalRequest; }
/** * Step 1 of the AWS Signature version 4 calculation. Refer to * http://docs.aws * .amazon.com/general/latest/gr/sigv4-create-canonical-request.html to * generate the canonical request. */ private String createCanonicalRequest(SdkHttpFullRequest.Builder request, String contentSha256, boolean doubleUrlEncode) { String canonicalRequest = request.method().toString() + SignerConstant.LINE_SEPARATOR + // This would optionally double url-encode the resource path getCanonicalizedResourcePath(request.encodedPath(), doubleUrlEncode) + SignerConstant.LINE_SEPARATOR + getCanonicalizedQueryString(request.rawQueryParameters()) + SignerConstant.LINE_SEPARATOR + getCanonicalizedHeaderString(request.headers()) + SignerConstant.LINE_SEPARATOR + getSignedHeadersString(request.headers()) + SignerConstant.LINE_SEPARATOR + contentSha256; LOG.trace(() -> "AWS4 Canonical Request: " + canonicalRequest); return canonicalRequest; }
/** * Creates the basic {@link SdkHttpFullRequest} with information from the {@link OperationInfo} and the endpoint. * * @param operationInfo Metadata about operation, contains HTTP method and request URI. * @param endpoint Endpoint of request. * @return Mutable {@link SdkHttpFullRequest.Builder} with HTTP method, URI, and static query parameters set. */ public static SdkHttpFullRequest.Builder createSdkHttpRequest(OperationInfo operationInfo, URI endpoint) { SdkHttpFullRequest.Builder request = SdkHttpFullRequest .builder() .method(operationInfo.httpMethod()) .uri(endpoint); return request.encodedPath(SdkHttpUtils.appendUri(request.encodedPath(), addStaticQueryParametersToRequest(request, operationInfo.requestUri()))); }
/** * Creates the basic {@link SdkHttpFullRequest} with information from the {@link OperationInfo} and the endpoint. * * @param operationInfo Metadata about operation, contains HTTP method and request URI. * @param endpoint Endpoint of request. * @return Mutable {@link SdkHttpFullRequest.Builder} with HTTP method, URI, and static query parameters set. */ public static SdkHttpFullRequest.Builder createSdkHttpRequest(OperationInfo operationInfo, URI endpoint) { SdkHttpFullRequest.Builder request = SdkHttpFullRequest .builder() .method(operationInfo.httpMethod()) .uri(endpoint); return request.encodedPath(SdkHttpUtils.appendUri(request.encodedPath(), addStaticQueryParametersToRequest(request, operationInfo.requestUri()))); }
@Override public SdkHttpFullRequest.Builder toBuilder() { return new Builder() .contentStreamProvider(contentStreamProvider) .protocol(protocol) .host(host) .port(port) .encodedPath(path) .rawQueryParameters(queryParameters) .method(httpMethod) .headers(headers) ; }
@Override public void marshall(T val, XmlMarshallerContext context, String paramName, SdkField<T> sdkField) { context.request().encodedPath( pathMarshaller.marshall(context.request().encodedPath(), paramName, converter.convert(val, sdkField))); } }
@Override public void marshall(T val, JsonMarshallerContext context, String paramName, SdkField<T> sdkField) { context.request().encodedPath( pathMarshaller.marshall(context.request().encodedPath(), paramName, converter.convert(val, sdkField))); }
private SdkHttpFullRequest.Builder fillBasicRequestParams(OperationInfo operationInfo) { return ProtocolUtils.createSdkHttpRequest(operationInfo, endpoint) .encodedPath("") .putRawQueryParameter("Action", operationInfo.operationIdentifier()) .putRawQueryParameter("Version", operationInfo.apiVersion()); }
private SdkHttpFullRequest.Builder fillBasicRequestParams(OperationInfo operationInfo) { return ProtocolUtils.createSdkHttpRequest(operationInfo, endpoint) .encodedPath("") .putRawQueryParameter("Action", operationInfo.operationIdentifier()) .putRawQueryParameter("Version", operationInfo.apiVersion()); }
@Override public void marshall(T val, XmlMarshallerContext context, String paramName, SdkField<T> sdkField) { context.request().encodedPath( pathMarshaller.marshall(context.request().encodedPath(), paramName, converter.convert(val, sdkField))); } }
@Override public SdkHttpFullRequest.Builder toBuilder() { return new Builder() .contentStreamProvider(contentStreamProvider) .protocol(protocol) .host(host) .port(port) .encodedPath(path) .rawQueryParameters(queryParameters) .method(httpMethod) .headers(headers) ; }
@Override public void marshall(T val, JsonMarshallerContext context, String paramName, SdkField<T> sdkField) { context.request().encodedPath( pathMarshaller.marshall(context.request().encodedPath(), paramName, converter.convert(val, sdkField))); }