@Test public void createRequestSupplierWithoutObjectPathStyleTest() throws URISyntaxException { final String objectName = null; final URI uri = new URI("http: final RequestSupplier request = createRequestSupplier(false, this.vaultName, this.hostName, null, objectName, this.uriRoot, this.trailingSlash, null); final Request req = request.get(); Assert.assertNotNull(req); Assert.assertEquals(Method.PUT, req.getMethod()); Assert.assertEquals(uri, req.getUri()); }
@Override public Request get() { final Map<String, String> requestContext = Maps.newHashMap(); for (final Function<Map<String, String>, String> function : this.context) { function.apply(requestContext); } if (this.delimiter != null) { this.delimiter.apply(requestContext); } if (this.container != null) { this.container.apply(requestContext); } if (this.credentials != null) { Credential credential = this.credentials.apply(requestContext); String username = credential.getUsername(); String password = credential.getPassword(); String keystoneToken = credential.getKeystoneToken(); String IAMToken = credential.getIAMToken(); String storageAccountName = credential.getStorageAccountName(); if(username != null) requestContext.put(Context.X_OG_USERNAME, username); if(password != null) requestContext.put(Context.X_OG_PASSWORD, password); if(keystoneToken != null) requestContext.put(Context.X_OG_KEYSTONE_TOKEN, keystoneToken); if(IAMToken != null) requestContext.put(Context.X_OG_IAM_TOKEN, IAMToken); if(storageAccountName != null) { requestContext.put(Context.X_OG_STORAGE_ACCOUNT_NAME, storageAccountName); } } if (this.sseSourceContext != null) { for (final Function<Map<String, String>, String> function : this.sseSourceContext) { function.apply(requestContext); } } Function<Map<String, String>, String> legalholdFunction; if (this.legalHold != null) { legalholdFunction = this.legalHold.get(); if (legalholdFunction != null) { legalholdFunction.apply(requestContext); } } if (this.staticWebsiteVirtualHostSuffix != null) { this.staticWebsiteVirtualHostSuffix.apply(requestContext); } URI uri = getUrl(requestContext); final HttpRequest.Builder builder = new HttpRequest.Builder(this.method, uri, this.operation); for (final Map.Entry<String, Function<Map<String, String>, String>> header : this.headers .entrySet()) { String key = header.getKey(); String value = header.getValue().apply(requestContext); builder.withHeader(key, value); } if (this.retention != null) { this.retention.apply(requestContext); if (this.operation != Operation.EXTEND_RETENTION) { if (requestContext.get(Context.X_OG_OBJECT_RETENTION) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION, requestContext.get(Context.X_OG_OBJECT_RETENTION)); } } else { if (requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION_EXT, requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT)); } } } if (requestContext.get(Context.X_OG_LEGAL_HOLD) != null) { builder.withHeader(Context.X_OG_LEGAL_HOLD, requestContext.get(Context.X_OG_LEGAL_HOLD)); } if (requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX) != null) { builder.withHeader("Host", requestContext.get(Context.X_OG_CONTAINER_NAME).concat(".") .concat(requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX))); } if (this.id != null) { builder.withContext(Context.X_OG_REQUEST_ID, this.id.apply(requestContext)); } for (final Map.Entry<String, String> entry : requestContext.entrySet()) { builder.withContext(entry.getKey(), entry.getValue()); } if (this.body != null) { Body body = this.body.apply(requestContext); builder.withBody(body); if (this.contentMd5) { try { Long size = body.getSize(); byte[] md5; if (this.operation == Operation.PUT_CONTAINER_LIFECYCLE || this.operation == Operation.PUT_CONTAINER_PROTECTION || this.operation == Operation.MULTI_DELETE) { builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(Hashing.md5() .newHasher() .putString(body.getContent(), Charsets.UTF_8).hash().asBytes())); } else { md5 = md5ContentCache.get(size); builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(md5)); } } catch (Exception e) { _logger.error(e.getMessage()); } } } String queryParameters = uri.getQuery(); if (queryParameters != null) { String[] params = queryParameters.split("&"); for (String s: params) { String[] keyValue = s.split("="); String key = s.split("=")[0]; if (keyValue.length > 1) { String value = s.split("=")[1]; builder.withQueryParameter(keyValue[0], keyValue[1]); } else { builder.withQueryParameter(keyValue[0], ""); } if (this.operation == Operation.LIST && key.equals(QueryParameters.S3_LIST_MAX_KEYS)) { builder.withContext(Context.X_OG_LIST_MAX_KEYS, keyValue[1]); } } } if (this.operation == Operation.MULTI_DELETE) { builder.withContext(Context.X_OG_RESPONSE_BODY_CONSUMER, "s3.multi_delete"); } return builder.build(); }
RequestSupplier implements Supplier<Request> { @Override public Request get() { final Map<String, String> requestContext = Maps.newHashMap(); for (final Function<Map<String, String>, String> function : this.context) { function.apply(requestContext); } if (this.delimiter != null) { this.delimiter.apply(requestContext); } if (this.container != null) { this.container.apply(requestContext); } if (this.credentials != null) { Credential credential = this.credentials.apply(requestContext); String username = credential.getUsername(); String password = credential.getPassword(); String keystoneToken = credential.getKeystoneToken(); String IAMToken = credential.getIAMToken(); String storageAccountName = credential.getStorageAccountName(); if(username != null) requestContext.put(Context.X_OG_USERNAME, username); if(password != null) requestContext.put(Context.X_OG_PASSWORD, password); if(keystoneToken != null) requestContext.put(Context.X_OG_KEYSTONE_TOKEN, keystoneToken); if(IAMToken != null) requestContext.put(Context.X_OG_IAM_TOKEN, IAMToken); if(storageAccountName != null) { requestContext.put(Context.X_OG_STORAGE_ACCOUNT_NAME, storageAccountName); } } if (this.sseSourceContext != null) { for (final Function<Map<String, String>, String> function : this.sseSourceContext) { function.apply(requestContext); } } Function<Map<String, String>, String> legalholdFunction; if (this.legalHold != null) { legalholdFunction = this.legalHold.get(); if (legalholdFunction != null) { legalholdFunction.apply(requestContext); } } if (this.staticWebsiteVirtualHostSuffix != null) { this.staticWebsiteVirtualHostSuffix.apply(requestContext); } URI uri = getUrl(requestContext); final HttpRequest.Builder builder = new HttpRequest.Builder(this.method, uri, this.operation); for (final Map.Entry<String, Function<Map<String, String>, String>> header : this.headers .entrySet()) { String key = header.getKey(); String value = header.getValue().apply(requestContext); builder.withHeader(key, value); } if (this.retention != null) { this.retention.apply(requestContext); if (this.operation != Operation.EXTEND_RETENTION) { if (requestContext.get(Context.X_OG_OBJECT_RETENTION) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION, requestContext.get(Context.X_OG_OBJECT_RETENTION)); } } else { if (requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION_EXT, requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT)); } } } if (requestContext.get(Context.X_OG_LEGAL_HOLD) != null) { builder.withHeader(Context.X_OG_LEGAL_HOLD, requestContext.get(Context.X_OG_LEGAL_HOLD)); } if (requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX) != null) { builder.withHeader("Host", requestContext.get(Context.X_OG_CONTAINER_NAME).concat(".") .concat(requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX))); } if (this.id != null) { builder.withContext(Context.X_OG_REQUEST_ID, this.id.apply(requestContext)); } for (final Map.Entry<String, String> entry : requestContext.entrySet()) { builder.withContext(entry.getKey(), entry.getValue()); } if (this.body != null) { Body body = this.body.apply(requestContext); builder.withBody(body); if (this.contentMd5) { try { Long size = body.getSize(); byte[] md5; if (this.operation == Operation.PUT_CONTAINER_LIFECYCLE || this.operation == Operation.PUT_CONTAINER_PROTECTION || this.operation == Operation.MULTI_DELETE) { builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(Hashing.md5() .newHasher() .putString(body.getContent(), Charsets.UTF_8).hash().asBytes())); } else { md5 = md5ContentCache.get(size); builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(md5)); } } catch (Exception e) { _logger.error(e.getMessage()); } } } String queryParameters = uri.getQuery(); if (queryParameters != null) { String[] params = queryParameters.split("&"); for (String s: params) { String[] keyValue = s.split("="); String key = s.split("=")[0]; if (keyValue.length > 1) { String value = s.split("=")[1]; builder.withQueryParameter(keyValue[0], keyValue[1]); } else { builder.withQueryParameter(keyValue[0], ""); } if (this.operation == Operation.LIST && key.equals(QueryParameters.S3_LIST_MAX_KEYS)) { builder.withContext(Context.X_OG_LIST_MAX_KEYS, keyValue[1]); } } } if (this.operation == Operation.MULTI_DELETE) { builder.withContext(Context.X_OG_RESPONSE_BODY_CONSUMER, "s3.multi_delete"); } return builder.build(); } }
RequestSupplier implements Supplier<Request> { @Override public Request get() { final Map<String, String> requestContext = Maps.newHashMap(); for (final Function<Map<String, String>, String> function : this.context) { function.apply(requestContext); } if (this.delimiter != null) { this.delimiter.apply(requestContext); } if (this.container != null) { this.container.apply(requestContext); } if (this.credentials != null) { Credential credential = this.credentials.apply(requestContext); String username = credential.getUsername(); String password = credential.getPassword(); String keystoneToken = credential.getKeystoneToken(); String IAMToken = credential.getIAMToken(); String storageAccountName = credential.getStorageAccountName(); if(username != null) requestContext.put(Context.X_OG_USERNAME, username); if(password != null) requestContext.put(Context.X_OG_PASSWORD, password); if(keystoneToken != null) requestContext.put(Context.X_OG_KEYSTONE_TOKEN, keystoneToken); if(IAMToken != null) requestContext.put(Context.X_OG_IAM_TOKEN, IAMToken); if(storageAccountName != null) { requestContext.put(Context.X_OG_STORAGE_ACCOUNT_NAME, storageAccountName); } } if (this.sseSourceContext != null) { for (final Function<Map<String, String>, String> function : this.sseSourceContext) { function.apply(requestContext); } } Function<Map<String, String>, String> legalholdFunction; if (this.legalHold != null) { legalholdFunction = this.legalHold.get(); if (legalholdFunction != null) { legalholdFunction.apply(requestContext); } } if (this.staticWebsiteVirtualHostSuffix != null) { this.staticWebsiteVirtualHostSuffix.apply(requestContext); } URI uri = getUrl(requestContext); final HttpRequest.Builder builder = new HttpRequest.Builder(this.method, uri, this.operation); for (final Map.Entry<String, Function<Map<String, String>, String>> header : this.headers .entrySet()) { String key = header.getKey(); String value = header.getValue().apply(requestContext); builder.withHeader(key, value); } if (this.retention != null) { this.retention.apply(requestContext); if (this.operation != Operation.EXTEND_RETENTION) { if (requestContext.get(Context.X_OG_OBJECT_RETENTION) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION, requestContext.get(Context.X_OG_OBJECT_RETENTION)); } } else { if (requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION_EXT, requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT)); } } } if (requestContext.get(Context.X_OG_LEGAL_HOLD) != null) { builder.withHeader(Context.X_OG_LEGAL_HOLD, requestContext.get(Context.X_OG_LEGAL_HOLD)); } if (requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX) != null) { builder.withHeader("Host", requestContext.get(Context.X_OG_CONTAINER_NAME).concat(".") .concat(requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX))); } if (this.id != null) { builder.withContext(Context.X_OG_REQUEST_ID, this.id.apply(requestContext)); } for (final Map.Entry<String, String> entry : requestContext.entrySet()) { builder.withContext(entry.getKey(), entry.getValue()); } if (this.body != null) { Body body = this.body.apply(requestContext); builder.withBody(body); if (this.contentMd5) { try { Long size = body.getSize(); byte[] md5; if (this.operation == Operation.PUT_CONTAINER_LIFECYCLE || this.operation == Operation.PUT_CONTAINER_PROTECTION || this.operation == Operation.MULTI_DELETE) { builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(Hashing.md5() .newHasher() .putString(body.getContent(), Charsets.UTF_8).hash().asBytes())); } else { md5 = md5ContentCache.get(size); builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(md5)); } } catch (Exception e) { _logger.error(e.getMessage()); } } } String queryParameters = uri.getQuery(); if (queryParameters != null) { String[] params = queryParameters.split("&"); for (String s: params) { String[] keyValue = s.split("="); String key = s.split("=")[0]; if (keyValue.length > 1) { String value = s.split("=")[1]; builder.withQueryParameter(keyValue[0], keyValue[1]); } else { builder.withQueryParameter(keyValue[0], ""); } if (this.operation == Operation.LIST && key.equals(QueryParameters.S3_LIST_MAX_KEYS)) { builder.withContext(Context.X_OG_LIST_MAX_KEYS, keyValue[1]); } } } if (this.operation == Operation.MULTI_DELETE) { builder.withContext(Context.X_OG_RESPONSE_BODY_CONSUMER, "s3.multi_delete"); } return builder.build(); } RequestSupplier(final Operation operation, final Function<Map<String, String>, String> id,
      final Method method, final Scheme scheme, final Function<Map<String, String>, String> host,
      final Integer port, final String uriRoot, final Function<Map<String, String>, String> container,
      final String apiVersion,
      final Function<Map<String, String>, String> object,
      final Map<String, Function<Map<String, String>, String>> queryParameters,
      final boolean trailingSlash, final Map<String, Function<Map<String, String>, String>> headers,
      final List<Function<Map<String, String>, String>> context,
      final List<Function<Map<String, String>, String>> sseSourceContext,
      final Function<Map<String, String>, Credential> credentials,
      final Function<Map<String, String>, Body> body, final boolean virtualHost,
      final Function<Map<String, String>, Long> retention,
      final Supplier<Function<Map<String, String>, String>> legalHold,
      final boolean contentMd5, final Function<Map<String, String>, String> delimiter,
      final Function<Map<String, String>, String> staticWebsiteVirtualHostSuffix); }
RequestSupplier implements Supplier<Request> { @Override public Request get() { final Map<String, String> requestContext = Maps.newHashMap(); for (final Function<Map<String, String>, String> function : this.context) { function.apply(requestContext); } if (this.delimiter != null) { this.delimiter.apply(requestContext); } if (this.container != null) { this.container.apply(requestContext); } if (this.credentials != null) { Credential credential = this.credentials.apply(requestContext); String username = credential.getUsername(); String password = credential.getPassword(); String keystoneToken = credential.getKeystoneToken(); String IAMToken = credential.getIAMToken(); String storageAccountName = credential.getStorageAccountName(); if(username != null) requestContext.put(Context.X_OG_USERNAME, username); if(password != null) requestContext.put(Context.X_OG_PASSWORD, password); if(keystoneToken != null) requestContext.put(Context.X_OG_KEYSTONE_TOKEN, keystoneToken); if(IAMToken != null) requestContext.put(Context.X_OG_IAM_TOKEN, IAMToken); if(storageAccountName != null) { requestContext.put(Context.X_OG_STORAGE_ACCOUNT_NAME, storageAccountName); } } if (this.sseSourceContext != null) { for (final Function<Map<String, String>, String> function : this.sseSourceContext) { function.apply(requestContext); } } Function<Map<String, String>, String> legalholdFunction; if (this.legalHold != null) { legalholdFunction = this.legalHold.get(); if (legalholdFunction != null) { legalholdFunction.apply(requestContext); } } if (this.staticWebsiteVirtualHostSuffix != null) { this.staticWebsiteVirtualHostSuffix.apply(requestContext); } URI uri = getUrl(requestContext); final HttpRequest.Builder builder = new HttpRequest.Builder(this.method, uri, this.operation); for (final Map.Entry<String, Function<Map<String, String>, String>> header : this.headers .entrySet()) { String key = header.getKey(); String value = header.getValue().apply(requestContext); builder.withHeader(key, value); } if (this.retention != null) { this.retention.apply(requestContext); if (this.operation != Operation.EXTEND_RETENTION) { if (requestContext.get(Context.X_OG_OBJECT_RETENTION) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION, requestContext.get(Context.X_OG_OBJECT_RETENTION)); } } else { if (requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION_EXT, requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT)); } } } if (requestContext.get(Context.X_OG_LEGAL_HOLD) != null) { builder.withHeader(Context.X_OG_LEGAL_HOLD, requestContext.get(Context.X_OG_LEGAL_HOLD)); } if (requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX) != null) { builder.withHeader("Host", requestContext.get(Context.X_OG_CONTAINER_NAME).concat(".") .concat(requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX))); } if (this.id != null) { builder.withContext(Context.X_OG_REQUEST_ID, this.id.apply(requestContext)); } for (final Map.Entry<String, String> entry : requestContext.entrySet()) { builder.withContext(entry.getKey(), entry.getValue()); } if (this.body != null) { Body body = this.body.apply(requestContext); builder.withBody(body); if (this.contentMd5) { try { Long size = body.getSize(); byte[] md5; if (this.operation == Operation.PUT_CONTAINER_LIFECYCLE || this.operation == Operation.PUT_CONTAINER_PROTECTION || this.operation == Operation.MULTI_DELETE) { builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(Hashing.md5() .newHasher() .putString(body.getContent(), Charsets.UTF_8).hash().asBytes())); } else { md5 = md5ContentCache.get(size); builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(md5)); } } catch (Exception e) { _logger.error(e.getMessage()); } } } String queryParameters = uri.getQuery(); if (queryParameters != null) { String[] params = queryParameters.split("&"); for (String s: params) { String[] keyValue = s.split("="); String key = s.split("=")[0]; if (keyValue.length > 1) { String value = s.split("=")[1]; builder.withQueryParameter(keyValue[0], keyValue[1]); } else { builder.withQueryParameter(keyValue[0], ""); } if (this.operation == Operation.LIST && key.equals(QueryParameters.S3_LIST_MAX_KEYS)) { builder.withContext(Context.X_OG_LIST_MAX_KEYS, keyValue[1]); } } } if (this.operation == Operation.MULTI_DELETE) { builder.withContext(Context.X_OG_RESPONSE_BODY_CONSUMER, "s3.multi_delete"); } return builder.build(); } RequestSupplier(final Operation operation, final Function<Map<String, String>, String> id,
      final Method method, final Scheme scheme, final Function<Map<String, String>, String> host,
      final Integer port, final String uriRoot, final Function<Map<String, String>, String> container,
      final String apiVersion,
      final Function<Map<String, String>, String> object,
      final Map<String, Function<Map<String, String>, String>> queryParameters,
      final boolean trailingSlash, final Map<String, Function<Map<String, String>, String>> headers,
      final List<Function<Map<String, String>, String>> context,
      final List<Function<Map<String, String>, String>> sseSourceContext,
      final Function<Map<String, String>, Credential> credentials,
      final Function<Map<String, String>, Body> body, final boolean virtualHost,
      final Function<Map<String, String>, Long> retention,
      final Supplier<Function<Map<String, String>, String>> legalHold,
      final boolean contentMd5, final Function<Map<String, String>, String> delimiter,
      final Function<Map<String, String>, String> staticWebsiteVirtualHostSuffix); @Override Request get(); @Override String toString(); }
RequestSupplier implements Supplier<Request> { @Override public Request get() { final Map<String, String> requestContext = Maps.newHashMap(); for (final Function<Map<String, String>, String> function : this.context) { function.apply(requestContext); } if (this.delimiter != null) { this.delimiter.apply(requestContext); } if (this.container != null) { this.container.apply(requestContext); } if (this.credentials != null) { Credential credential = this.credentials.apply(requestContext); String username = credential.getUsername(); String password = credential.getPassword(); String keystoneToken = credential.getKeystoneToken(); String IAMToken = credential.getIAMToken(); String storageAccountName = credential.getStorageAccountName(); if(username != null) requestContext.put(Context.X_OG_USERNAME, username); if(password != null) requestContext.put(Context.X_OG_PASSWORD, password); if(keystoneToken != null) requestContext.put(Context.X_OG_KEYSTONE_TOKEN, keystoneToken); if(IAMToken != null) requestContext.put(Context.X_OG_IAM_TOKEN, IAMToken); if(storageAccountName != null) { requestContext.put(Context.X_OG_STORAGE_ACCOUNT_NAME, storageAccountName); } } if (this.sseSourceContext != null) { for (final Function<Map<String, String>, String> function : this.sseSourceContext) { function.apply(requestContext); } } Function<Map<String, String>, String> legalholdFunction; if (this.legalHold != null) { legalholdFunction = this.legalHold.get(); if (legalholdFunction != null) { legalholdFunction.apply(requestContext); } } if (this.staticWebsiteVirtualHostSuffix != null) { this.staticWebsiteVirtualHostSuffix.apply(requestContext); } URI uri = getUrl(requestContext); final HttpRequest.Builder builder = new HttpRequest.Builder(this.method, uri, this.operation); for (final Map.Entry<String, Function<Map<String, String>, String>> header : this.headers .entrySet()) { String key = header.getKey(); String value = header.getValue().apply(requestContext); builder.withHeader(key, value); } if (this.retention != null) { this.retention.apply(requestContext); if (this.operation != Operation.EXTEND_RETENTION) { if (requestContext.get(Context.X_OG_OBJECT_RETENTION) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION, requestContext.get(Context.X_OG_OBJECT_RETENTION)); } } else { if (requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT) != null) { builder.withHeader(Context.X_OG_OBJECT_RETENTION_EXT, requestContext.get(Context.X_OG_OBJECT_RETENTION_EXT)); } } } if (requestContext.get(Context.X_OG_LEGAL_HOLD) != null) { builder.withHeader(Context.X_OG_LEGAL_HOLD, requestContext.get(Context.X_OG_LEGAL_HOLD)); } if (requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX) != null) { builder.withHeader("Host", requestContext.get(Context.X_OG_CONTAINER_NAME).concat(".") .concat(requestContext.get(Context.X_OG_STATIC_WEBSITE_VIRTUAL_HOST_SUFFIX))); } if (this.id != null) { builder.withContext(Context.X_OG_REQUEST_ID, this.id.apply(requestContext)); } for (final Map.Entry<String, String> entry : requestContext.entrySet()) { builder.withContext(entry.getKey(), entry.getValue()); } if (this.body != null) { Body body = this.body.apply(requestContext); builder.withBody(body); if (this.contentMd5) { try { Long size = body.getSize(); byte[] md5; if (this.operation == Operation.PUT_CONTAINER_LIFECYCLE || this.operation == Operation.PUT_CONTAINER_PROTECTION || this.operation == Operation.MULTI_DELETE) { builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(Hashing.md5() .newHasher() .putString(body.getContent(), Charsets.UTF_8).hash().asBytes())); } else { md5 = md5ContentCache.get(size); builder.withHeader(Context.X_OG_CONTENT_MD5, BaseEncoding.base64().encode(md5)); } } catch (Exception e) { _logger.error(e.getMessage()); } } } String queryParameters = uri.getQuery(); if (queryParameters != null) { String[] params = queryParameters.split("&"); for (String s: params) { String[] keyValue = s.split("="); String key = s.split("=")[0]; if (keyValue.length > 1) { String value = s.split("=")[1]; builder.withQueryParameter(keyValue[0], keyValue[1]); } else { builder.withQueryParameter(keyValue[0], ""); } if (this.operation == Operation.LIST && key.equals(QueryParameters.S3_LIST_MAX_KEYS)) { builder.withContext(Context.X_OG_LIST_MAX_KEYS, keyValue[1]); } } } if (this.operation == Operation.MULTI_DELETE) { builder.withContext(Context.X_OG_RESPONSE_BODY_CONSUMER, "s3.multi_delete"); } return builder.build(); } RequestSupplier(final Operation operation, final Function<Map<String, String>, String> id,
      final Method method, final Scheme scheme, final Function<Map<String, String>, String> host,
      final Integer port, final String uriRoot, final Function<Map<String, String>, String> container,
      final String apiVersion,
      final Function<Map<String, String>, String> object,
      final Map<String, Function<Map<String, String>, String>> queryParameters,
      final boolean trailingSlash, final Map<String, Function<Map<String, String>, String>> headers,
      final List<Function<Map<String, String>, String>> context,
      final List<Function<Map<String, String>, String>> sseSourceContext,
      final Function<Map<String, String>, Credential> credentials,
      final Function<Map<String, String>, Body> body, final boolean virtualHost,
      final Function<Map<String, String>, Long> retention,
      final Supplier<Function<Map<String, String>, String>> legalHold,
      final boolean contentMd5, final Function<Map<String, String>, String> delimiter,
      final Function<Map<String, String>, String> staticWebsiteVirtualHostSuffix); @Override Request get(); @Override String toString();  }