Permalink
Browse files

[Java][Feign] Add support for Feign 10 (#977) (#988)

  • Loading branch information...
ihrankouski authored and wing328 committed Sep 9, 2018
1 parent 825404a commit aa29219f8cb8aafef82d0fe49448a5b77f26311a
@@ -1,4 +1,7 @@
{
"library": "feign",
"artifactId": "petstore-feign"
"artifactId": "petstore-feign",
"additionalProperties": {
"useFeign10": true
}
}
View
@@ -137,7 +137,7 @@ CONFIG OPTIONS for java
library
library template (sub-template) to use (Default: okhttp-gson)
jersey1 - HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.8.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
feign - HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9
feign - HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9. Enable OpenFeign 10.0.1 using '-DuseFeign10=true'.
jersey2 - HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.9
okhttp-gson - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
retrofit - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
@@ -19,6 +19,9 @@ import org.apache.oltu.oauth2.common.message.types.GrantType;
import org.apache.oltu.oauth2.common.token.BasicOAuthToken;
import feign.Client;
{{#useFeign10}}
import feign.Request.HttpMethod;
{{/useFeign10}}
import feign.Request.Options;
import feign.RequestInterceptor;
import feign.RequestTemplate;
@@ -92,7 +95,12 @@ public class OAuth implements RequestInterceptor {
try {
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
} catch (Exception e) {
{{#useFeign10}}
throw new RetryableException(e.getMessage(), HttpMethod.POST, e, null);
{{/useFeign10}}
{{^useFeign10}}
throw new RetryableException(e.getMessage(), e,null);
{{/useFeign10}}
}
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
@@ -123,7 +123,7 @@ ext {
{{#threetenbp}}
threepane_version = "2.6.4"
{{/threetenbp}}
feign_version = "9.4.0"
feign_version = "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}"
feign_form_version = "2.1.0"
junit_version = "4.12"
oltu_version = "1.0.1"
@@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.21" % "compile",
"io.github.openfeign" % "feign-core" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-core" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile",
"io.github.openfeign" % "feign-jackson" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile",
"io.github.openfeign" % "feign-slf4j" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile",
"io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile",
@@ -293,7 +293,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-annotations-version>1.5.21</swagger-annotations-version>
<feign-version>9.4.0</feign-version>
<feign-version>{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}</feign-version>
<feign-form-version>2.1.0</feign-form-version>
<jackson-version>2.8.9</jackson-version>
{{#threetenbp}}
@@ -97,7 +97,7 @@ ext {
swagger_annotations_version = "1.5.21"
jackson_version = "2.8.7"
threepane_version = "2.6.4"
feign_version = "9.4.0"
feign_version = "10.0.1"
feign_form_version = "2.1.0"
junit_version = "4.12"
oltu_version = "1.0.1"
@@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.21" % "compile",
"io.github.openfeign" % "feign-core" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile",
"io.github.openfeign" % "feign-core" % "10.0.1" % "compile",
"io.github.openfeign" % "feign-jackson" % "10.0.1" % "compile",
"io.github.openfeign" % "feign-slf4j" % "10.0.1" % "compile",
"io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile",
@@ -267,7 +267,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-annotations-version>1.5.21</swagger-annotations-version>
<feign-version>9.4.0</feign-version>
<feign-version>10.0.1</feign-version>
<feign-form-version>2.1.0</feign-form-version>
<jackson-version>2.8.9</jackson-version>
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
@@ -19,6 +19,7 @@
import org.apache.oltu.oauth2.common.token.BasicOAuthToken;
import feign.Client;
import feign.Request.HttpMethod;
import feign.Request.Options;
import feign.RequestInterceptor;
import feign.RequestTemplate;
@@ -92,7 +93,7 @@ public synchronized void updateAccessToken() {
try {
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
} catch (Exception e) {
throw new RetryableException(e.getMessage(), e,null);
throw new RetryableException(e.getMessage(), HttpMethod.POST, e, null);
}
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());

0 comments on commit aa29219

Please sign in to comment.