private static void populateRequestMetadata(InternalRequest request, ObjectMetadata metadata) {
        if (metadata.getContentType() != null) {
            request.addHeader(Headers.CONTENT_TYPE, metadata.getContentType());
        }
        if (metadata.getContentMd5() != null) {
            request.addHeader(Headers.CONTENT_MD5, metadata.getContentMd5());
        }
        if (metadata.getContentEncoding() != null) {
            request.addHeader(Headers.CONTENT_ENCODING, metadata.getContentEncoding());
        }
        if (metadata.getBceContentSha256() != null) {
            request.addHeader(Headers.BCE_CONTENT_SHA256, metadata.getBceContentSha256());
        }
        if (metadata.getContentDisposition() != null) {
            request.addHeader(Headers.CONTENT_DISPOSITION, metadata.getContentDisposition());
        }
        if (metadata.getETag() != null) {
            request.addHeader(Headers.ETAG, metadata.getETag());
        }
        if (metadata.getExpires() != null) {
            request.addHeader(Headers.EXPIRES, metadata.getExpires());
        }
        if (metadata.getCacheControl() != null) {
            request.addHeader(Headers.CACHE_CONTROL, metadata.getCacheControl());
        }
        if (metadata.getStorageClass() != null) {
            request.addHeader(Headers.BCE_STORAGE_CLASS, metadata.getStorageClass());
        }

        Map<String, String> userMetadata = metadata.getUserMetadata();
        if (userMetadata != null) {
            for (Entry<String, String> entry : userMetadata.entrySet()) {
                String key = entry.getKey();
                if (key == null) {
                    continue;
                }
                String value = entry.getValue();
                if (value == null) {
                    value = "";
                }
                if (key.length() + value.length() > 1024 * 32) {
                    throw new BceClientException("MetadataTooLarge");
                }
                request.addHeader(Headers.BCE_USER_METADATA_PREFIX + HttpUtils.normalize(key.trim()),
                        HttpUtils.normalize(value));
            }
        }
    }
private static void populateRequestMetadata ( InternalRequest request , ObjectMetadata metadata ) { if ( metadata . getContentType ( ) != null ) { request . addHeader ( Headers . CONTENT_TYPE , metadata . getContentType ( ) ) ; } if ( metadata . getContentMd5 ( ) != null ) { request . addHeader ( Headers . CONTENT_MD5 , metadata . getContentMd5 ( ) ) ; } if ( metadata . getContentEncoding ( ) != null ) { request . addHeader ( Headers . CONTENT_ENCODING , metadata . getContentEncoding ( ) ) ; } if ( metadata . getBceContentSha256 ( ) != null ) { request . addHeader ( Headers . BCE_CONTENT_SHA256 , metadata . getBceContentSha256 ( ) ) ; } if ( metadata . getContentDisposition ( ) != null ) { request . addHeader ( Headers . CONTENT_DISPOSITION , metadata . getContentDisposition ( ) ) ; } if ( metadata . getETag ( ) != null ) { request . addHeader ( Headers . ETAG , metadata . getETag ( ) ) ; } if ( metadata . getExpires ( ) != null ) { request . addHeader ( Headers . EXPIRES , metadata . getExpires ( ) ) ; } if ( metadata . getCacheControl ( ) != null ) { request . addHeader ( Headers . CACHE_CONTROL , metadata . getCacheControl ( ) ) ; } if ( metadata . getStorageClass ( ) != null ) { request . addHeader ( Headers . BCE_STORAGE_CLASS , metadata . getStorageClass ( ) ) ; } Map < String , String > userMetadata = metadata . getUserMetadata ( ) ; if ( userMetadata != null ) { for ( Entry < String , String > entry : userMetadata . entrySet ( ) ) { String key = entry . getKey ( ) ; if ( key == null ) { continue ; } String value = entry . getValue ( ) ; if ( value == null ) { value = "" ; } if ( key . length ( ) + value . length ( ) > 1024 * 32 ) { throw new BceClientException ( "MetadataTooLarge" ) ; } request . addHeader ( Headers . BCE_USER_METADATA_PREFIX + HttpUtils . normalize ( key . trim ( ) ) , HttpUtils . normalize ( value ) ) ; } } }
Populates the specified request object with the appropriate headers from the ObjectMetadata object.

@param request The request to populate with headers.
@param metadata The metadata containing the header information to include in the request.