Code example for ImmutableMultimap.Builder

Methods: build, put

0
 
      request = metadataPrefixer.bindToRequest(request, md.getUserMetadata());
 
      Builder<String, String> headers = ImmutableMultimap.builder();
      if (md.getCacheControl() != null) {
         headers.put(HttpHeaders.CACHE_CONTROL, md.getCacheControl());
      } 
 
      if (md.getContentMetadata().getContentDisposition() != null) {
         headers.put("Content-Disposition", md.getContentMetadata().getContentDisposition());
      } 
 
      if (md.getContentMetadata().getContentEncoding() != null) {
         headers.put("Content-Encoding", md.getContentMetadata().getContentEncoding());
      } 
      if (md.getContentMetadata().getContentType() != null) {
         headers.put(HttpHeaders.CONTENT_TYPE, md.getContentMetadata().getContentType());
      } else { 
         headers.put(HttpHeaders.CONTENT_TYPE, "binary/octet-stream");
      } 
 
      if (md.getContentMetadata().getContentMD5() != null) {
         headers.put("Content-MD5", base64().encode(md.getContentMetadata().getContentMD5()));
      } 
 
      return (R) request.toBuilder().replaceHeaders(headers.build()).build();
   } 
}