12
12
*/
13
13
package org .asynchttpclient ;
14
14
15
- import static org .asynchttpclient .util .MiscUtils .getBoolean ;
15
+ import org .asynchttpclient .util .AsyncPropertiesHelper ;
16
+ import org .asynchttpclient .util .DefaultHostnameVerifier ;
17
+
18
+ import javax .net .ssl .HostnameVerifier ;
16
19
17
20
public final class AsyncHttpClientConfigDefaults {
18
21
@@ -22,106 +25,106 @@ private AsyncHttpClientConfigDefaults() {
22
25
public static final String ASYNC_CLIENT = AsyncHttpClientConfig .class .getName () + "." ;
23
26
24
27
public static int defaultMaxConnections () {
25
- return Integer . getInteger ( ASYNC_CLIENT + "maxConnections" , - 1 );
28
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "maxConnections" );
26
29
}
27
30
28
31
public static int defaultMaxConnectionsPerHost () {
29
- return Integer . getInteger ( ASYNC_CLIENT + "maxConnectionsPerHost" , - 1 );
32
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "maxConnectionsPerHost" );
30
33
}
31
34
32
35
public static int defaultConnectionTimeout () {
33
- return Integer . getInteger ( ASYNC_CLIENT + "connectionTimeout" , 60 * 1000 );
36
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "connectionTimeout" );
34
37
}
35
38
36
39
public static int defaultPooledConnectionIdleTimeout () {
37
- return Integer . getInteger ( ASYNC_CLIENT + "pooledConnectionIdleTimeout" , 60 * 1000 );
40
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "pooledConnectionIdleTimeout" );
38
41
}
39
42
40
43
public static int defaultReadTimeout () {
41
- return Integer . getInteger ( ASYNC_CLIENT + "readTimeout" , 60 * 1000 );
44
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "readTimeout" );
42
45
}
43
46
44
47
public static int defaultRequestTimeout () {
45
- return Integer . getInteger ( ASYNC_CLIENT + "requestTimeout" , 60 * 1000 );
48
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "requestTimeout" );
46
49
}
47
50
48
51
public static int defaultWebSocketTimeout () {
49
- return Integer . getInteger ( ASYNC_CLIENT + "webSocketTimeout" , 15 * 60 * 1000 );
52
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "webSocketTimeout" );
50
53
}
51
54
52
55
public static int defaultConnectionTTL () {
53
- return Integer . getInteger ( ASYNC_CLIENT + "connectionTTL" , - 1 );
56
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "connectionTTL" );
54
57
}
55
58
56
59
public static boolean defaultFollowRedirect () {
57
- return Boolean .getBoolean (ASYNC_CLIENT + "followRedirect" );
60
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "followRedirect" );
58
61
}
59
62
60
63
public static int defaultMaxRedirects () {
61
- return Integer . getInteger ( ASYNC_CLIENT + "maxRedirects" , 5 );
64
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "maxRedirects" );
62
65
}
63
66
64
67
public static boolean defaultCompressionEnforced () {
65
- return Boolean .getBoolean (ASYNC_CLIENT + "compressionEnforced" );
68
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "compressionEnforced" );
66
69
}
67
70
68
71
public static String defaultUserAgent () {
69
- return System . getProperty ( ASYNC_CLIENT + "userAgent" , "AHC/2.0 " );
72
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getString ( ASYNC_CLIENT + "userAgent" );
70
73
}
71
74
72
75
public static int defaultIoThreadMultiplier () {
73
- return Integer . getInteger ( ASYNC_CLIENT + "ioThreadMultiplier" , 2 );
76
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "ioThreadMultiplier" );
74
77
}
75
78
76
79
public static boolean defaultUseProxySelector () {
77
- return Boolean .getBoolean (ASYNC_CLIENT + "useProxySelector" );
80
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "useProxySelector" );
78
81
}
79
82
80
83
public static boolean defaultUseProxyProperties () {
81
- return Boolean .getBoolean (ASYNC_CLIENT + "useProxyProperties" );
84
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "useProxyProperties" );
82
85
}
83
86
84
87
public static boolean defaultStrict302Handling () {
85
- return Boolean .getBoolean (ASYNC_CLIENT + "strict302Handling" );
88
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "strict302Handling" );
86
89
}
87
90
88
91
public static boolean defaultAllowPoolingConnections () {
89
- return getBoolean (ASYNC_CLIENT + "allowPoolingConnections" , true );
92
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getBoolean (ASYNC_CLIENT + "allowPoolingConnections" );
90
93
}
91
94
92
95
public static boolean defaultUseRelativeURIsWithConnectProxies () {
93
- return getBoolean (ASYNC_CLIENT + "useRelativeURIsWithConnectProxies" , true );
94
- }
96
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getBoolean (ASYNC_CLIENT + "useRelativeURIsWithConnectProxies" );
97
+ }
95
98
96
99
public static int defaultMaxRequestRetry () {
97
- return Integer . getInteger ( ASYNC_CLIENT + "maxRequestRetry" , 5 );
100
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "maxRequestRetry" );
98
101
}
99
102
100
103
public static boolean defaultAllowPoolingSslConnections () {
101
- return getBoolean (ASYNC_CLIENT + "allowPoolingSslConnections" , true );
104
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getBoolean (ASYNC_CLIENT + "allowPoolingSslConnections" );
102
105
}
103
106
104
107
public static boolean defaultDisableUrlEncodingForBoundRequests () {
105
- return Boolean .getBoolean (ASYNC_CLIENT + "disableUrlEncodingForBoundRequests" );
108
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "disableUrlEncodingForBoundRequests" );
106
109
}
107
110
108
111
public static boolean defaultRemoveQueryParamOnRedirect () {
109
- return getBoolean (ASYNC_CLIENT + "removeQueryParamOnRedirect" , true );
112
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getBoolean (ASYNC_CLIENT + "removeQueryParamOnRedirect" );
110
113
}
111
114
112
115
public static boolean defaultSpdyEnabled () {
113
- return Boolean .getBoolean (ASYNC_CLIENT + "spdyEnabled" );
116
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig () .getBoolean (ASYNC_CLIENT + "spdyEnabled" );
114
117
}
115
118
116
119
public static int defaultSpdyInitialWindowSize () {
117
- return Integer . getInteger ( ASYNC_CLIENT + "spdyInitialWindowSize" , 10 * 1024 * 1024 );
120
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "spdyInitialWindowSize" );
118
121
}
119
122
120
123
public static int defaultSpdyMaxConcurrentStreams () {
121
- return Integer . getInteger ( ASYNC_CLIENT + "spdyMaxConcurrentStreams" , 100 );
124
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getInt ( ASYNC_CLIENT + "spdyMaxConcurrentStreams" );
122
125
}
123
126
124
127
public static boolean defaultAcceptAnyCertificate () {
125
- return getBoolean (ASYNC_CLIENT + "acceptAnyCertificate" , false );
128
+ return AsyncPropertiesHelper . getAsyncHttpClientConfig (). getBoolean (ASYNC_CLIENT + "acceptAnyCertificate" );
126
129
}
127
130
}
0 commit comments