16
16
*/
17
17
package com .ning .http .client ;
18
18
19
+ import java .net .URI ;
19
20
import java .util .ArrayList ;
20
21
import java .util .Collections ;
21
22
import java .util .List ;
22
23
24
+ import com .ning .http .util .AsyncHttpProviderUtils ;
25
+
23
26
/**
24
27
* Represents a proxy server.
25
28
*/
@@ -44,13 +47,14 @@ public String toString() {
44
47
}
45
48
}
46
49
47
- private String encoding = "UTF-8" ;
48
50
private final List <String > nonProxyHosts = new ArrayList <String >();
49
51
private final Protocol protocol ;
50
52
private final String host ;
51
53
private final String principal ;
52
54
private final String password ;
53
- private int port ;
55
+ private final int port ;
56
+ private final URI uri ;
57
+ private String encoding = "UTF-8" ;
54
58
private String ntlmDomain = System .getProperty ("http.auth.ntlm.domain" , "" );
55
59
56
60
private boolean isBasic = true ;
@@ -69,6 +73,7 @@ public ProxyServer(final Protocol protocol, final String host, final int port, S
69
73
this .port = port ;
70
74
this .principal = principal ;
71
75
this .password = password ;
76
+ this .uri = AsyncHttpProviderUtils .createUri (toString ());
72
77
}
73
78
74
79
public ProxyServer (final String host , final int port , String principal , String password ) {
@@ -116,6 +121,10 @@ public String getEncoding() {
116
121
return encoding ;
117
122
}
118
123
124
+ public URI getURI () {
125
+ return uri ;
126
+ }
127
+
119
128
public ProxyServer addNonProxyHost (String uri ) {
120
129
nonProxyHosts .add (uri );
121
130
return this ;
@@ -141,7 +150,7 @@ public String getNtlmDomain() {
141
150
142
151
@ Override
143
152
public String toString () {
144
- return String . format ( "%s ://%s:%d" , protocol . toString (), host , port ) ;
153
+ return protocol + " ://" + host + ":" + port ;
145
154
}
146
155
}
147
156
0 commit comments