@Test(expectedExceptions = NullPointerException.class) public void testNullIsBad() { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: binder.bindToRequest(request, null); }
@SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { String encodedJson = base64().encode(checkNotNull(input, "json").toString().getBytes(UTF_8)); Builder<String, String> builder = ImmutableMultimap.builder(); builder.put("Storage.S3.UploadPolicy", encodedJson); String signature = signer.sign(encodedJson); builder.put("Storage.S3.UploadPolicySignature", signature); return (R) request.toBuilder().replaceFormParams(builder.build()).build(); }
BindS3UploadPolicyAndSignature implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { String encodedJson = base64().encode(checkNotNull(input, "json").toString().getBytes(UTF_8)); Builder<String, String> builder = ImmutableMultimap.builder(); builder.put("Storage.S3.UploadPolicy", encodedJson); String signature = signer.sign(encodedJson); builder.put("Storage.S3.UploadPolicySignature", signature); return (R) request.toBuilder().replaceFormParams(builder.build()).build(); } }
BindS3UploadPolicyAndSignature implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { String encodedJson = base64().encode(checkNotNull(input, "json").toString().getBytes(UTF_8)); Builder<String, String> builder = ImmutableMultimap.builder(); builder.put("Storage.S3.UploadPolicy", encodedJson); String signature = signer.sign(encodedJson); builder.put("Storage.S3.UploadPolicySignature", signature); return (R) request.toBuilder().replaceFormParams(builder.build()).build(); } @Inject  BindS3UploadPolicyAndSignature(FormSignerV2 signer); }
BindS3UploadPolicyAndSignature implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { String encodedJson = base64().encode(checkNotNull(input, "json").toString().getBytes(UTF_8)); Builder<String, String> builder = ImmutableMultimap.builder(); builder.put("Storage.S3.UploadPolicy", encodedJson); String signature = signer.sign(encodedJson); builder.put("Storage.S3.UploadPolicySignature", signature); return (R) request.toBuilder().replaceFormParams(builder.build()).build(); } @Inject  BindS3UploadPolicyAndSignature(FormSignerV2 signer); @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input); }
BindS3UploadPolicyAndSignature implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { String encodedJson = base64().encode(checkNotNull(input, "json").toString().getBytes(UTF_8)); Builder<String, String> builder = ImmutableMultimap.builder(); builder.put("Storage.S3.UploadPolicy", encodedJson); String signature = signer.sign(encodedJson); builder.put("Storage.S3.UploadPolicySignature", signature); return (R) request.toBuilder().replaceFormParams(builder.build()).build(); } @Inject  BindS3UploadPolicyAndSignature(FormSignerV2 signer); @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input);  }