private void preparePostHeader ( HttpPost httpPost , String acceptMimeType , String contentMimeType ) { if ( acceptMimeType != null && ! acceptMimeType . equals ( "" ) ) { httpPost . setHeader ( new BasicHeader ( "accept" , acceptMimeType ) ) ; } if ( contentMimeType != null && ! contentMimeType . equals ( "" ) ) { httpPost . setHeader ( new BasicHeader ( "Content-Type" , contentMimeType ) ) ; } httpPost . setHeader ( new BasicHeader ( "project-id" , projectId ) ) ; if ( token != null && bearerToken != null ) { httpPost . setHeader ( new BasicHeader ( "authorization" , bearerToken . replaceAll ( "\"" , "" ) ) ) ; } }
Add accept content - type projectId and token headers to an HttpPost object .