Skip to content

Commit ad136c3

Browse files
authored
1 parent d2175a9 commit ad136c3

File tree

138 files changed

+3351
-2960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+3351
-2960
lines changed

benchmark/src/main/java/feign/benchmark/DecoderIteratorsBenchmark.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import feign.jackson.JacksonIteratorDecoder;
2222
import feign.stream.StreamDecoder;
2323
import org.openjdk.jmh.annotations.*;
24-
2524
import java.lang.reflect.Type;
2625
import java.util.Collection;
2726
import java.util.Collections;
@@ -89,18 +88,15 @@ public void buildDecoder() {
8988
switch (api) {
9089
case "list":
9190
decoder = new JacksonDecoder();
92-
type = new TypeReference<List<Car>>() {
93-
}.getType();
91+
type = new TypeReference<List<Car>>() {}.getType();
9492
break;
9593
case "iterator":
9694
decoder = JacksonIteratorDecoder.create();
97-
type = new TypeReference<Iterator<Car>>() {
98-
}.getType();
95+
type = new TypeReference<Iterator<Car>>() {}.getType();
9996
break;
10097
case "stream":
10198
decoder = StreamDecoder.create(JacksonIteratorDecoder.create());
102-
type = new TypeReference<Stream<Car>>() {
103-
}.getType();
99+
type = new TypeReference<Stream<Car>>() {}.getType();
104100
break;
105101
default:
106102
throw new IllegalStateException("Unknown api: " + api);

benchmark/src/main/java/feign/benchmark/FeignTestInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package feign.benchmark;
1515

1616
import java.util.List;
17-
1817
import feign.Body;
1918
import feign.Headers;
2019
import feign.Param;
@@ -41,7 +40,8 @@ Response mixedParams(@Param("domainId") int id,
4140

4241
@RequestLine("POST /")
4342
@Body("%7B\"customer_name\": \"{customer_name}\", \"user_name\": \"{user_name}\", \"password\": \"{password}\"%7D")
44-
void form(@Param("customer_name") String customer, @Param("user_name") String user,
43+
void form(@Param("customer_name") String customer,
44+
@Param("user_name") String user,
4545
@Param("password") String password);
4646

4747
@RequestLine("POST /")

benchmark/src/main/java/feign/benchmark/RealRequestBenchmarks.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import okhttp3.OkHttpClient;
1717
import okhttp3.Request;
18-
1918
import org.openjdk.jmh.annotations.Benchmark;
2019
import org.openjdk.jmh.annotations.BenchmarkMode;
2120
import org.openjdk.jmh.annotations.Fork;
@@ -27,10 +26,8 @@
2726
import org.openjdk.jmh.annotations.State;
2827
import org.openjdk.jmh.annotations.TearDown;
2928
import org.openjdk.jmh.annotations.Warmup;
30-
3129
import java.io.IOException;
3230
import java.util.concurrent.TimeUnit;
33-
3431
import feign.Feign;
3532
import feign.Response;
3633
import io.netty.buffer.ByteBuf;

benchmark/src/main/java/feign/benchmark/WhatShouldWeCacheBenchmarks.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@
2323
import org.openjdk.jmh.annotations.Setup;
2424
import org.openjdk.jmh.annotations.State;
2525
import org.openjdk.jmh.annotations.Warmup;
26-
2726
import java.io.IOException;
2827
import java.util.Collection;
2928
import java.util.LinkedHashMap;
3029
import java.util.List;
3130
import java.util.Map;
3231
import java.util.concurrent.TimeUnit;
33-
3432
import feign.Client;
3533
import feign.Contract;
3634
import feign.Feign;

core/src/main/java/feign/Body.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616
import java.lang.annotation.Retention;
1717
import java.lang.annotation.Target;
1818
import java.util.Map;
19-
2019
import static java.lang.annotation.ElementType.METHOD;
2120
import static java.lang.annotation.RetentionPolicy.RUNTIME;
2221

2322
/**
2423
* A possibly templated body of a PUT or POST command. variables wrapped in curly braces are
25-
* expanded before the request is submitted. <br> ex. <br>
24+
* expanded before the request is submitted. <br>
25+
* ex. <br>
26+
*
2627
* <pre>
2728
* &#064;Body(&quot;&lt;v01:getResourceRecordsOfZone&gt;&lt;zoneName&gt;{zoneName}&lt;/zoneName&gt;&lt;rrType&gt;0&lt;/rrType&gt;&lt;/v01:getResourceRecordsOfZone&gt;&quot;)
2829
* List&lt;Record&gt; listByZone(&#64;Param(&quot;zoneName&quot;) String zoneName);
2930
* </pre>
30-
* <br> Note that if you'd like curly braces literally in the body, urlencode them first.
31+
*
32+
* <br>
33+
* Note that if you'd like curly braces literally in the body, urlencode them first.
3134
*
3235
* @see RequestTemplate#expand(String, Map)
3336
*/

core/src/main/java/feign/Client.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package feign;
1515

1616
import static java.lang.String.format;
17-
1817
import java.io.IOException;
1918
import java.io.InputStream;
2019
import java.io.OutputStream;
@@ -26,13 +25,10 @@
2625
import java.util.Map;
2726
import java.util.zip.DeflaterOutputStream;
2827
import java.util.zip.GZIPOutputStream;
29-
3028
import javax.net.ssl.HostnameVerifier;
3129
import javax.net.ssl.HttpsURLConnection;
3230
import javax.net.ssl.SSLSocketFactory;
33-
3431
import feign.Request.Options;
35-
3632
import static feign.Util.CONTENT_ENCODING;
3733
import static feign.Util.CONTENT_LENGTH;
3834
import static feign.Util.ENCODING_DEFLATE;
@@ -73,8 +69,7 @@ public Response execute(Request request, Options options) throws IOException {
7369
}
7470

7571
HttpURLConnection convertAndSend(Request request, Options options) throws IOException {
76-
final HttpURLConnection
77-
connection =
72+
final HttpURLConnection connection =
7873
(HttpURLConnection) new URL(request.url()).openConnection();
7974
if (connection instanceof HttpsURLConnection) {
8075
HttpsURLConnection sslCon = (HttpsURLConnection) connection;
@@ -92,11 +87,9 @@ HttpURLConnection convertAndSend(Request request, Options options) throws IOExce
9287
connection.setRequestMethod(request.method());
9388

9489
Collection<String> contentEncodingValues = request.headers().get(CONTENT_ENCODING);
95-
boolean
96-
gzipEncodedRequest =
90+
boolean gzipEncodedRequest =
9791
contentEncodingValues != null && contentEncodingValues.contains(ENCODING_GZIP);
98-
boolean
99-
deflateEncodedRequest =
92+
boolean deflateEncodedRequest =
10093
contentEncodingValues != null && contentEncodingValues.contains(ENCODING_DEFLATE);
10194

10295
boolean hasAcceptHeader = false;
@@ -174,11 +167,11 @@ Response convertResponse(HttpURLConnection connection) throws IOException {
174167
stream = connection.getInputStream();
175168
}
176169
return Response.builder()
177-
.status(status)
178-
.reason(reason)
179-
.headers(headers)
180-
.body(stream, length)
181-
.build();
170+
.status(status)
171+
.reason(reason)
172+
.headers(headers)
173+
.body(stream, length)
174+
.build();
182175
}
183176
}
184177
}

core/src/main/java/feign/CollectionFormat.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
/**
1919
* Various ways to encode collections in URL parameters.
2020
*
21-
* <p>These specific cases are inspired by the
22-
* <a href="http://swagger.io/specification/">OpenAPI specification</a>.</p>
21+
* <p>
22+
* These specific cases are inspired by the <a href="http://swagger.io/specification/">OpenAPI
23+
* specification</a>.
24+
* </p>
2325
*/
2426
public enum CollectionFormat {
2527
/** Comma separated values, eg foo=bar,baz */
@@ -43,18 +45,24 @@ public enum CollectionFormat {
4345
/**
4446
* Joins the field and possibly multiple values with the given separator.
4547
*
46-
* <p>Calling EXPLODED.join("foo", ["bar"]) will return "foo=bar".</p>
48+
* <p>
49+
* Calling EXPLODED.join("foo", ["bar"]) will return "foo=bar".
50+
* </p>
4751
*
48-
* <p>Calling CSV.join("foo", ["bar", "baz"]) will return "foo=bar,baz". </p>
52+
* <p>
53+
* Calling CSV.join("foo", ["bar", "baz"]) will return "foo=bar,baz".
54+
* </p>
4955
*
50-
* <p>Null values are treated somewhat specially. With EXPLODED, the field
51-
* is repeated without any "=" for backwards compatibility. With all other
52-
* formats, null values are not included in the joined value list.</p>
56+
* <p>
57+
* Null values are treated somewhat specially. With EXPLODED, the field is repeated without any
58+
* "=" for backwards compatibility. With all other formats, null values are not included in the
59+
* joined value list.
60+
* </p>
5361
*
5462
* @param field The field name corresponding to these values.
5563
* @param values A collection of value strings for the given field.
56-
* @return The formatted char sequence of the field and joined values. If the
57-
* value collection is empty, an empty char sequence will be returned.
64+
* @return The formatted char sequence of the field and joined values. If the value collection is
65+
* empty, an empty char sequence will be returned.
5866
*/
5967
CharSequence join(String field, Collection<String> values) {
6068
StringBuilder builder = new StringBuilder();

0 commit comments

Comments
 (0)