private void setRequestHeaders ( HttpURLConnection ucon , GenericUser authenticationUser , String [ ] requestHedaers ) { if ( authenticationUser != null ) { String authenticationString = authenticationUser . getUserName ( ) + ":" + authenticationUser . getPassword ( ) ; byte [ ] encodedAuthentication = Base64 . encodeBase64 ( authenticationString . getBytes ( ) ) ; String authenticationHeaderValue = "Basic " + new String ( encodedAuthentication ) ; ucon . setRequestProperty ( "Authorization" , authenticationHeaderValue ) ; } for ( int i = 0 ; i < requestHedaers . length ; i = i + 2 ) { ucon . setRequestProperty ( getReferenceService ( ) . namespaceString ( requestHedaers [ i ] ) , getReferenceService ( ) . namespaceString ( requestHedaers [ i + 1 ] ) ) ; } }
Add the request headers to the request