public static Map < String , String > populateRequestProperties ( Map < String , String > requestProperties , int bodyLength , MediaType contentType , MediaType acceptType ) { Map < String , String > properties ; // requestProperties 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 .