public static void setRequestProperties ( final Properties props , HttpURLConnection conn , Integer timeout ) { if ( props != null ) { if ( props . get ( "User-Agent" ) == null ) { conn . setRequestProperty ( "User-Agent" , "Java" ) ; } for ( Entry entry : props . entrySet ( ) ) { conn . setRequestProperty ( String . valueOf ( entry . getKey ( ) ) , String . valueOf ( entry . getValue ( ) ) ) ; } } if ( timeout != null ) { conn . setConnectTimeout ( timeout * 1000 ) ; } }
Sets request headers for an http connection