15
15
*/
16
16
package com .ning .http .client .providers .netty ;
17
17
18
- import com .ning .http .client .AsyncHandler ;
19
- import com .ning .http .client .AsyncHandler .STATE ;
20
- import com .ning .http .client .AsyncHttpClientConfig ;
21
- import com .ning .http .client .AsyncHttpProvider ;
22
- import com .ning .http .client .Body ;
23
- import com .ning .http .client .ConnectionsPool ;
24
- import com .ning .http .client .Cookie ;
25
- import com .ning .http .client .FluentCaseInsensitiveStringsMap ;
26
- import com .ning .http .client .HttpResponseBodyPart ;
27
- import com .ning .http .client .HttpResponseHeaders ;
28
- import com .ning .http .client .HttpResponseStatus ;
29
- import com .ning .http .client .ListenableFuture ;
30
- import com .ning .http .client .MaxRedirectException ;
31
- import com .ning .http .client .PerRequestConfig ;
32
- import com .ning .http .client .ProgressAsyncHandler ;
33
- import com .ning .http .client .ProxyServer ;
34
- import com .ning .http .client .RandomAccessBody ;
35
- import com .ning .http .client .Realm ;
36
- import com .ning .http .client .Request ;
37
- import com .ning .http .client .RequestBuilder ;
38
- import com .ning .http .client .Response ;
39
- import com .ning .http .client .filter .FilterContext ;
40
- import com .ning .http .client .filter .FilterException ;
41
- import com .ning .http .client .filter .IOExceptionFilter ;
42
- import com .ning .http .client .filter .ResponseFilter ;
43
- import com .ning .http .client .listener .TransferCompletionHandler ;
44
- import com .ning .http .client .ntlm .NTLMEngine ;
45
- import com .ning .http .client .ntlm .NTLMEngineException ;
46
- import com .ning .http .client .providers .netty .spnego .SpnegoEngine ;
47
- import com .ning .http .multipart .MultipartBody ;
48
- import com .ning .http .multipart .MultipartRequestEntity ;
49
- import com .ning .http .util .AsyncHttpProviderUtils ;
50
- import com .ning .http .util .AuthenticatorUtils ;
51
- import com .ning .http .util .CleanupChannelGroup ;
52
- import com .ning .http .util .ProxyUtils ;
53
- import com .ning .http .util .SslUtils ;
54
- import com .ning .http .util .UTF8UrlEncoder ;
18
+ import static com .ning .http .util .AsyncHttpProviderUtils .DEFAULT_CHARSET ;
19
+ import static org .jboss .netty .channel .Channels .pipeline ;
20
+
21
+ import java .io .File ;
22
+ import java .io .FileInputStream ;
23
+ import java .io .IOException ;
24
+ import java .io .RandomAccessFile ;
25
+ import java .net .ConnectException ;
26
+ import java .net .InetSocketAddress ;
27
+ import java .net .MalformedURLException ;
28
+ import java .net .URI ;
29
+ import java .nio .channels .ClosedChannelException ;
30
+ import java .nio .channels .FileChannel ;
31
+ import java .nio .channels .WritableByteChannel ;
32
+ import java .security .GeneralSecurityException ;
33
+ import java .security .NoSuchAlgorithmException ;
34
+ import java .util .ArrayList ;
35
+ import java .util .Collection ;
36
+ import java .util .Iterator ;
37
+ import java .util .List ;
38
+ import java .util .Map .Entry ;
39
+ import java .util .concurrent .Callable ;
40
+ import java .util .concurrent .ExecutionException ;
41
+ import java .util .concurrent .ExecutorService ;
42
+ import java .util .concurrent .Executors ;
43
+ import java .util .concurrent .Future ;
44
+ import java .util .concurrent .RejectedExecutionException ;
45
+ import java .util .concurrent .Semaphore ;
46
+ import java .util .concurrent .TimeUnit ;
47
+ import java .util .concurrent .TimeoutException ;
48
+ import java .util .concurrent .atomic .AtomicBoolean ;
49
+
50
+ import javax .net .ssl .SSLEngine ;
51
+
55
52
import org .jboss .netty .bootstrap .ClientBootstrap ;
56
53
import org .jboss .netty .buffer .ChannelBuffer ;
57
54
import org .jboss .netty .buffer .ChannelBufferOutputStream ;
92
89
import org .slf4j .Logger ;
93
90
import org .slf4j .LoggerFactory ;
94
91
95
- import javax .net .ssl .SSLEngine ;
96
- import java .io .File ;
97
- import java .io .FileInputStream ;
98
- import java .io .IOException ;
99
- import java .io .RandomAccessFile ;
100
- import java .net .ConnectException ;
101
- import java .net .InetSocketAddress ;
102
- import java .net .MalformedURLException ;
103
- import java .net .URI ;
104
- import java .nio .channels .ClosedChannelException ;
105
- import java .nio .channels .FileChannel ;
106
- import java .nio .channels .WritableByteChannel ;
107
- import java .security .GeneralSecurityException ;
108
- import java .security .NoSuchAlgorithmException ;
109
- import java .util .ArrayList ;
110
- import java .util .Collection ;
111
- import java .util .Iterator ;
112
- import java .util .List ;
113
- import java .util .Map .Entry ;
114
- import java .util .concurrent .Callable ;
115
- import java .util .concurrent .ExecutionException ;
116
- import java .util .concurrent .ExecutorService ;
117
- import java .util .concurrent .Executors ;
118
- import java .util .concurrent .Future ;
119
- import java .util .concurrent .RejectedExecutionException ;
120
- import java .util .concurrent .Semaphore ;
121
- import java .util .concurrent .TimeUnit ;
122
- import java .util .concurrent .TimeoutException ;
123
- import java .util .concurrent .atomic .AtomicBoolean ;
124
-
125
- import static com .ning .http .util .AsyncHttpProviderUtils .DEFAULT_CHARSET ;
126
- import static org .jboss .netty .channel .Channels .pipeline ;
92
+ import com .ning .http .client .AsyncHandler ;
93
+ import com .ning .http .client .AsyncHandler .STATE ;
94
+ import com .ning .http .client .AsyncHttpClientConfig ;
95
+ import com .ning .http .client .AsyncHttpProvider ;
96
+ import com .ning .http .client .Body ;
97
+ import com .ning .http .client .ConnectionsPool ;
98
+ import com .ning .http .client .Cookie ;
99
+ import com .ning .http .client .FluentCaseInsensitiveStringsMap ;
100
+ import com .ning .http .client .HttpResponseBodyPart ;
101
+ import com .ning .http .client .HttpResponseHeaders ;
102
+ import com .ning .http .client .HttpResponseStatus ;
103
+ import com .ning .http .client .ListenableFuture ;
104
+ import com .ning .http .client .MaxRedirectException ;
105
+ import com .ning .http .client .PerRequestConfig ;
106
+ import com .ning .http .client .ProgressAsyncHandler ;
107
+ import com .ning .http .client .ProxyServer ;
108
+ import com .ning .http .client .RandomAccessBody ;
109
+ import com .ning .http .client .Realm ;
110
+ import com .ning .http .client .Request ;
111
+ import com .ning .http .client .RequestBuilder ;
112
+ import com .ning .http .client .Response ;
113
+ import com .ning .http .client .filter .FilterContext ;
114
+ import com .ning .http .client .filter .FilterException ;
115
+ import com .ning .http .client .filter .IOExceptionFilter ;
116
+ import com .ning .http .client .filter .ResponseFilter ;
117
+ import com .ning .http .client .listener .TransferCompletionHandler ;
118
+ import com .ning .http .client .ntlm .NTLMEngine ;
119
+ import com .ning .http .client .ntlm .NTLMEngineException ;
120
+ import com .ning .http .client .providers .netty .spnego .SpnegoEngine ;
121
+ import com .ning .http .multipart .MultipartBody ;
122
+ import com .ning .http .multipart .MultipartRequestEntity ;
123
+ import com .ning .http .util .AsyncHttpProviderUtils ;
124
+ import com .ning .http .util .AuthenticatorUtils ;
125
+ import com .ning .http .util .CleanupChannelGroup ;
126
+ import com .ning .http .util .ProxyUtils ;
127
+ import com .ning .http .util .SslUtils ;
128
+ import com .ning .http .util .UTF8UrlEncoder ;
127
129
128
130
public class NettyAsyncHttpProvider extends SimpleChannelUpstreamHandler implements AsyncHttpProvider {
129
131
private final static String HTTP_HANDLER = "httpHandler" ;
@@ -1101,8 +1103,7 @@ public void messageReceived(final ChannelHandlerContext ctx, MessageEvent e) thr
1101
1103
} else {
1102
1104
Realm .RealmBuilder realmBuilder ;
1103
1105
if (realm != null ) {
1104
- realmBuilder = new Realm .RealmBuilder ().clone (realm ).setScheme (realm .getAuthScheme ())
1105
- ;
1106
+ realmBuilder = new Realm .RealmBuilder ().clone (realm ).setScheme (realm .getAuthScheme ());
1106
1107
} else {
1107
1108
realmBuilder = new Realm .RealmBuilder ();
1108
1109
}
@@ -1114,7 +1115,9 @@ public void messageReceived(final ChannelHandlerContext ctx, MessageEvent e) thr
1114
1115
.build ();
1115
1116
}
1116
1117
1117
- final Realm nr = newRealm ;
1118
+ // final Realm nr = newRealm;
1119
+ final Realm nr = new Realm .RealmBuilder ().clone (newRealm )
1120
+ .setUri (request .getUrl ()).build ();
1118
1121
1119
1122
log .debug ("Sending authentication to {}" , request .getUrl ());
1120
1123
AsyncCallable ac = new AsyncCallable (future ) {
0 commit comments