@@ -47,12 +47,27 @@ public CloseableHttpClient getHttpClient() throws FileNotFoundException, IOExcep
47
47
{
48
48
CloseableHttpClient httpclient = null ;
49
49
50
+ Header contentHeader = new BasicHeader ( HttpHeaders .CONTENT_TYPE , this .contentType == null ? "application/xml" : this .contentType );
51
+ Header acceptHeader = new BasicHeader ( HttpHeaders .ACCEPT , this .accept != null ? this .accept : config .getAccept ());
52
+ Header userAgentHeader = new BasicHeader ( HttpHeaders .USER_AGENT , config .getUserAgent ());
53
+
54
+ List <Header > headers = new ArrayList <Header >();
55
+ headers .add (contentHeader );
56
+ headers .add (acceptHeader );
57
+ headers .add (userAgentHeader );
58
+
59
+ if (this .ifModifiedSince != null ) {
60
+ Header modifiedHeader = new BasicHeader ( HttpHeaders .IF_MODIFIED_SINCE , this .ifModifiedSince );
61
+ headers .add (modifiedHeader );
62
+ }
63
+
64
+
50
65
if ((config .getKeyStorePath () == null || config .getKeyStorePath ().length () == 0 ) && (config .getKeyStorePassword () == null || config .getKeyStorePassword ().length () == 0 ))
51
66
{
52
67
if (logger .isInfoEnabled ()){
53
68
logger .info ("You must use Java 1.8 to skip setting the Key Store Path & Key Store Password in config.json" );
54
69
}
55
- httpclient = HttpClients .createDefault ();
70
+ httpclient = HttpClients .custom (). setDefaultHeaders ( headers ). build ();
56
71
57
72
} else {
58
73
if (logger .isInfoEnabled ()){
@@ -107,20 +122,6 @@ public CloseableHttpClient getHttpClient() throws FileNotFoundException, IOExcep
107
122
new String [] {"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" ,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" ,"TLS_RSA_WITH_AES_128_CBC_SHA256" ,"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256" ,"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256" ,"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" ,"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" ,"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" ,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" ,"TLS_RSA_WITH_AES_128_CBC_SHA" ,"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA" ,"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA" ,"TLS_DHE_RSA_WITH_AES_128_CBC_SHA" ,"TLS_DHE_DSS_WITH_AES_128_CBC_SHA" ,"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" ,"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" ,"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA" ,"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA" ,"TLS_EMPTY_RENEGOTIATION_INFO_SCSV" },
108
123
SSLConnectionSocketFactory .getDefaultHostnameVerifier ());
109
124
110
- Header contentHeader = new BasicHeader ( HttpHeaders .CONTENT_TYPE , this .contentType == null ? "application/xml" : this .contentType );
111
- Header acceptHeader = new BasicHeader ( HttpHeaders .ACCEPT , this .accept != null ? this .accept : config .getAccept ());
112
- Header userAgentHeader = new BasicHeader ( HttpHeaders .USER_AGENT , config .getUserAgent ());
113
-
114
- List <Header > headers = new ArrayList <Header >();
115
- headers .add (contentHeader );
116
- headers .add (acceptHeader );
117
- headers .add (userAgentHeader );
118
-
119
- if (this .ifModifiedSince != null ) {
120
- Header modifiedHeader = new BasicHeader ( HttpHeaders .IF_MODIFIED_SINCE , this .ifModifiedSince );
121
- headers .add (modifiedHeader );
122
- }
123
-
124
125
httpclient = HttpClients .custom ()
125
126
.setSSLSocketFactory (sslsf )
126
127
.setDefaultHeaders (headers )
0 commit comments