Skip to content

Commit baa7aec

Browse files
committed
Polishing
(cherry picked from commit 7f280a3)
1 parent d859826 commit baa7aec

11 files changed

+44
-51
lines changed

spring-web/src/main/java/org/springframework/http/client/HttpComponentsAsyncClientHttpRequest.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,15 +40,15 @@
4040

4141

4242
/**
43-
* {@link ClientHttpRequest} implementation that uses Apache HttpComponents HttpClient to
44-
* execute requests.
43+
* {@link ClientHttpRequest} implementation based on
44+
* Apache HttpComponents HttpAsyncClient.
4545
*
46-
* <p>Created via the {@link org.springframework.http.client.HttpComponentsClientHttpRequestFactory}.
46+
* <p>Created via the {@link HttpComponentsClientHttpRequestFactory}.
4747
*
4848
* @author Oleg Kalnichevski
4949
* @author Arjen Poutsma
5050
* @since 4.0
51-
* @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory#createRequest
51+
* @see HttpComponentsClientHttpRequestFactory#createRequest
5252
*/
5353
final class HttpComponentsAsyncClientHttpRequest extends AbstractBufferingAsyncClientHttpRequest {
5454

@@ -59,10 +59,10 @@ final class HttpComponentsAsyncClientHttpRequest extends AbstractBufferingAsyncC
5959
private final HttpContext httpContext;
6060

6161

62-
HttpComponentsAsyncClientHttpRequest(HttpAsyncClient httpClient, HttpUriRequest httpRequest, HttpContext httpContext) {
63-
this.httpClient = httpClient;
64-
this.httpRequest = httpRequest;
65-
this.httpContext = httpContext;
62+
HttpComponentsAsyncClientHttpRequest(HttpAsyncClient client, HttpUriRequest request, HttpContext context) {
63+
this.httpClient = client;
64+
this.httpRequest = request;
65+
this.httpContext = context;
6666
}
6767

6868

@@ -92,22 +92,21 @@ protected ListenableFuture<ClientHttpResponse> executeInternal(HttpHeaders heade
9292
entityEnclosingRequest.setEntity(requestEntity);
9393
}
9494

95-
final HttpResponseFutureCallback callback = new HttpResponseFutureCallback(this.httpRequest);
96-
final Future<HttpResponse> futureResponse =
97-
this.httpClient.execute(this.httpRequest, this.httpContext, callback);
95+
HttpResponseFutureCallback callback = new HttpResponseFutureCallback(this.httpRequest);
96+
Future<HttpResponse> futureResponse = this.httpClient.execute(this.httpRequest, this.httpContext, callback);
9897
return new ClientHttpResponseFuture(futureResponse, callback);
9998
}
10099

101100

102101
private static class HttpResponseFutureCallback implements FutureCallback<HttpResponse> {
103102

104-
private final HttpUriRequest httpRequest;
103+
private final HttpUriRequest request;
105104

106105
private final ListenableFutureCallbackRegistry<ClientHttpResponse> callbacks =
107106
new ListenableFutureCallbackRegistry<ClientHttpResponse>();
108107

109-
public HttpResponseFutureCallback(HttpUriRequest httpRequest) {
110-
this.httpRequest = httpRequest;
108+
public HttpResponseFutureCallback(HttpUriRequest request) {
109+
this.request = request;
111110
}
112111

113112
public void addCallback(ListenableFutureCallback<? super ClientHttpResponse> callback) {
@@ -134,7 +133,7 @@ public void failed(Exception ex) {
134133

135134
@Override
136135
public void cancelled() {
137-
this.httpRequest.abort();
136+
this.request.abort();
138137
}
139138
}
140139

@@ -144,8 +143,8 @@ private static class ClientHttpResponseFuture extends FutureAdapter<ClientHttpRe
144143

145144
private final HttpResponseFutureCallback callback;
146145

147-
public ClientHttpResponseFuture(Future<HttpResponse> futureResponse, HttpResponseFutureCallback callback) {
148-
super(futureResponse);
146+
public ClientHttpResponseFuture(Future<HttpResponse> response, HttpResponseFutureCallback callback) {
147+
super(response);
149148
this.callback = callback;
150149
}
151150

@@ -166,5 +165,4 @@ public void addCallback(SuccessCallback<? super ClientHttpResponse> successCallb
166165
}
167166
}
168167

169-
170168
}

spring-web/src/main/java/org/springframework/http/client/HttpComponentsAsyncClientHttpResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,8 +27,8 @@
2727
import org.springframework.util.StreamUtils;
2828

2929
/**
30-
* {@link ClientHttpResponse} implementation that uses
31-
* Apache HttpComponents HttpClient to execute requests.
30+
* {@link ClientHttpResponse} implementation based on
31+
* Apache HttpComponents HttpAsyncClient.
3232
*
3333
* <p>Created via the {@link HttpComponentsAsyncClientHttpRequest}.
3434
*

spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,13 +35,11 @@
3535
import org.springframework.util.StringUtils;
3636

3737
/**
38-
* {@link org.springframework.http.client.ClientHttpRequest} implementation that uses
39-
* Apache HttpComponents HttpClient to execute requests.
38+
* {@link ClientHttpRequest} implementation based on
39+
* Apache HttpComponents HttpClient.
4040
*
4141
* <p>Created via the {@link HttpComponentsClientHttpRequestFactory}.
4242
*
43-
* <p><b>NOTE:</b> Requires Apache HttpComponents 4.3 or higher, as of Spring 4.0.
44-
*
4543
* @author Oleg Kalnichevski
4644
* @author Arjen Poutsma
4745
* @author Juergen Hoeller
@@ -57,10 +55,10 @@ final class HttpComponentsClientHttpRequest extends AbstractBufferingClientHttpR
5755
private final HttpContext httpContext;
5856

5957

60-
HttpComponentsClientHttpRequest(HttpClient httpClient, HttpUriRequest httpRequest, HttpContext httpContext) {
61-
this.httpClient = httpClient;
62-
this.httpRequest = httpRequest;
63-
this.httpContext = httpContext;
58+
HttpComponentsClientHttpRequest(HttpClient client, HttpUriRequest request, HttpContext context) {
59+
this.httpClient = client;
60+
this.httpRequest = request;
61+
this.httpContext = context;
6462
}
6563

6664

spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,13 +29,11 @@
2929
import org.springframework.util.StreamUtils;
3030

3131
/**
32-
* {@link org.springframework.http.client.ClientHttpResponse} implementation that uses
33-
* Apache HttpComponents HttpClient to execute requests.
32+
* {@link ClientHttpResponse} implementation based on
33+
* Apache HttpComponents HttpClient.
3434
*
3535
* <p>Created via the {@link HttpComponentsClientHttpRequest}.
3636
*
37-
* <p><b>NOTE:</b> Requires Apache HttpComponents 4.3 or higher, as of Spring 4.0.
38-
*
3937
* @author Oleg Kalnichevski
4038
* @author Arjen Poutsma
4139
* @since 3.1

spring-web/src/main/java/org/springframework/http/client/HttpComponentsStreamingClientHttpRequest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@
3636
import org.springframework.http.StreamingHttpOutputMessage;
3737

3838
/**
39-
* {@link ClientHttpRequest} implementation that uses Apache HttpComponents
40-
* HttpClient to execute requests.
39+
* {@link ClientHttpRequest} implementation based on
40+
* Apache HttpComponents HttpClient in streaming mode.
4141
*
4242
* <p>Created via the {@link HttpComponentsClientHttpRequestFactory}.
4343
*
4444
* @author Arjen Poutsma
4545
* @since 4.0
4646
* @see HttpComponentsClientHttpRequestFactory#createRequest(java.net.URI, org.springframework.http.HttpMethod)
4747
*/
48-
final class HttpComponentsStreamingClientHttpRequest extends AbstractClientHttpRequest implements StreamingHttpOutputMessage {
48+
final class HttpComponentsStreamingClientHttpRequest extends AbstractClientHttpRequest
49+
implements StreamingHttpOutputMessage {
4950

5051
private final HttpClient httpClient;
5152

@@ -56,10 +57,10 @@ final class HttpComponentsStreamingClientHttpRequest extends AbstractClientHttpR
5657
private Body body;
5758

5859

59-
HttpComponentsStreamingClientHttpRequest(HttpClient httpClient, HttpUriRequest httpRequest, HttpContext httpContext) {
60-
this.httpClient = httpClient;
61-
this.httpRequest = httpRequest;
62-
this.httpContext = httpContext;
60+
HttpComponentsStreamingClientHttpRequest(HttpClient client, HttpUriRequest request, HttpContext context) {
61+
this.httpClient = client;
62+
this.httpRequest = request;
63+
this.httpContext = context;
6364
}
6465

6566

spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
import org.springframework.util.concurrent.SettableListenableFuture;
4343

4444
/**
45-
* {@link org.springframework.http.client.ClientHttpRequest} implementation
46-
* that uses Netty 4 to execute requests.
45+
* {@link ClientHttpRequest} implementation based on Netty 4.
4746
*
4847
* <p>Created via the {@link Netty4ClientHttpRequestFactory}.
4948
*

spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
import org.springframework.util.Assert;
2929

3030
/**
31-
* {@link org.springframework.http.client.ClientHttpResponse} implementation
32-
* that uses Netty 4 to parse responses.
31+
* {@link ClientHttpResponse} implementation based on Netty 4.
3332
*
3433
* @author Arjen Poutsma
3534
* @since 4.1.2

spring-web/src/main/java/org/springframework/http/client/OkHttp3AsyncClientHttpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.springframework.util.concurrent.SettableListenableFuture;
3232

3333
/**
34-
* {@link AsyncClientHttpRequest} implementation that uses OkHttp 3.x to execute requests.
34+
* {@link AsyncClientHttpRequest} implementation based on OkHttp 3.x.
3535
*
3636
* <p>Created via the {@link OkHttp3ClientHttpRequestFactory}.
3737
*

spring-web/src/main/java/org/springframework/http/client/OkHttp3ClientHttpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.springframework.http.HttpMethod;
2727

2828
/**
29-
* {@link ClientHttpRequest} implementation that uses OkHttp 3.x to execute requests.
29+
* {@link ClientHttpRequest} implementation based on OkHttp 3.x.
3030
*
3131
* <p>Created via the {@link OkHttp3ClientHttpRequestFactory}.
3232
*

spring-web/src/main/java/org/springframework/http/client/OkHttpAsyncClientHttpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.springframework.util.concurrent.SettableListenableFuture;
3232

3333
/**
34-
* {@link AsyncClientHttpRequest} implementation that uses OkHttp 2.x to execute requests.
34+
* {@link AsyncClientHttpRequest} implementation based on OkHttp 2.x.
3535
*
3636
* <p>Created via the {@link OkHttpClientHttpRequestFactory}.
3737
*

0 commit comments

Comments
 (0)