@@ -37,10 +37,8 @@ public class AsyncHttpProviderUtils {
37
37
38
38
public static final void validateSupportedScheme (Uri uri ) {
39
39
final String scheme = uri .getScheme ();
40
- if (scheme == null || !scheme .equalsIgnoreCase ("http" ) && !scheme .equalsIgnoreCase ("https" ) && !scheme .equalsIgnoreCase ("ws" )
41
- && !scheme .equalsIgnoreCase ("wss" )) {
42
- throw new IllegalArgumentException ("The URI scheme, of the URI " + uri
43
- + ", must be equal (ignoring case) to 'http', 'https', 'ws', or 'wss'" );
40
+ if (scheme == null || !scheme .equalsIgnoreCase ("http" ) && !scheme .equalsIgnoreCase ("https" ) && !scheme .equalsIgnoreCase ("ws" ) && !scheme .equalsIgnoreCase ("wss" )) {
41
+ throw new IllegalArgumentException ("The URI scheme, of the URI " + uri + ", must be equal (ignoring case) to 'http', 'https', 'ws', or 'wss'" );
44
42
}
45
43
}
46
44
@@ -49,14 +47,12 @@ public final static String getBaseUrl(Uri uri) {
49
47
}
50
48
51
49
public final static String getAuthority (Uri uri ) {
52
- int port = uri .getPort () != -1 ? uri .getPort () : getDefaultPort (uri );
50
+ int port = uri .getPort () != -1 ? uri .getPort () : getDefaultPort (uri );
53
51
return uri .getHost () + ":" + port ;
54
52
}
55
53
56
54
public final static boolean isSameHostAndProtocol (Uri uri1 , Uri uri2 ) {
57
- return uri1 .getScheme ().equals (uri2 .getScheme ())
58
- && uri1 .getHost ().equals (uri2 .getHost ())
59
- && getDefaultPort (uri1 ) == getDefaultPort (uri2 );
55
+ return uri1 .getScheme ().equals (uri2 .getScheme ()) && uri1 .getHost ().equals (uri2 .getHost ()) && getDefaultPort (uri1 ) == getDefaultPort (uri2 );
60
56
}
61
57
62
58
public static final int getSchemeDefaultPort (String scheme ) {
@@ -98,16 +94,12 @@ public static Charset parseCharset(String contentType) {
98
94
return null ;
99
95
}
100
96
101
- public static String keepAliveHeaderValue (AsyncHttpClientConfig config ) {
102
- return config .isAllowPoolingConnections () ? "keep-alive" : "close" ;
103
- }
104
-
105
97
public static int requestTimeout (AsyncHttpClientConfig config , Request request ) {
106
98
return request .getRequestTimeout () != 0 ? request .getRequestTimeout () : config .getRequestTimeout ();
107
99
}
108
100
109
101
public static boolean followRedirect (AsyncHttpClientConfig config , Request request ) {
110
- return request .getFollowRedirect () != null ? request .getFollowRedirect ().booleanValue () : config .isFollowRedirect ();
102
+ return request .getFollowRedirect () != null ? request .getFollowRedirect ().booleanValue () : config .isFollowRedirect ();
111
103
}
112
104
113
105
private static StringBuilder urlEncodeFormParams0 (List <Param > params ) {
@@ -118,7 +110,7 @@ private static StringBuilder urlEncodeFormParams0(List<Param> params) {
118
110
sb .setLength (sb .length () - 1 );
119
111
return sb ;
120
112
}
121
-
113
+
122
114
public static ByteBuffer urlEncodeFormParams (List <Param > params , Charset charset ) {
123
115
return StringUtils .charSequence2ByteBuffer (urlEncodeFormParams0 (params ), charset );
124
116
}
@@ -131,7 +123,7 @@ private static void encodeAndAppendFormParam(final StringBuilder sb, final CharS
131
123
}
132
124
sb .append ('&' );
133
125
}
134
-
126
+
135
127
public static String hostHeader (Request request , Uri uri ) {
136
128
String virtualHost = request .getVirtualHost ();
137
129
if (virtualHost != null )
0 commit comments