public static Map<String,String> populateRequestProperties(Map<String,String> requestProperties,int bodyLength,MediaType contentType,MediaType acceptType){
  Map<String,String> properties;
  if (requestProperties == null || requestProperties.isEmpty()) {
    properties=new HashMap<>();
  }
 else {
    properties=new HashMap<>(requestProperties);
  }
  if (acceptType != null) {
    properties.put(HeaderNames.ACCEPT,acceptType.toString());
  }
  if (contentType != null) {
    properties.put(HeaderNames.CONTENT_TYPE,contentType.toString());
  }
  if (bodyLength > -1) {
    properties.put(HeaderNames.CONTENT_LENGTH,String.valueOf(bodyLength));
  }
  return properties;
}

public static Map < String , String > populateRequestProperties ( Map < String , String > requestProperties , int bodyLength , MediaType contentType , MediaType acceptType ) { Map < String , String > properties ; if ( requestProperties == null || requestProperties . isEmpty ( ) ) { properties = new HashMap < > ( ) ; } else { properties = new HashMap < > ( requestProperties ) ; } if ( acceptType != null ) { properties . put ( HeaderNames . ACCEPT , acceptType . toString ( ) ) ; } if ( contentType != null ) { properties . put ( HeaderNames . CONTENT_TYPE , contentType . toString ( ) ) ; } if ( bodyLength > - 1 ) { properties . put ( HeaderNames . CONTENT_LENGTH , String . valueOf ( bodyLength ) ) ; } return properties ; }
util method for first populating request properties before execution .
