Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
9da71b16
Commit
9da71b16
authored
Dec 01, 2016
by
Ryan Baxter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unnecessary null check and fixed imports
parent
ed31004a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
21 deletions
+7
-21
RibbonLoadBalancingHttpClient.java
.../netflix/ribbon/apache/RibbonLoadBalancingHttpClient.java
+0
-7
OkHttpLoadBalancingClient.java
...loud/netflix/ribbon/okhttp/OkHttpLoadBalancingClient.java
+4
-12
OkHttpLoadBalancingClientTests.java
...netflix/ribbon/okhttp/OkHttpLoadBalancingClientTests.java
+3
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/apache/RibbonLoadBalancingHttpClient.java
View file @
9da71b16
...
...
@@ -76,19 +76,12 @@ public class RibbonLoadBalancingHttpClient
final
IClientConfig
configOverride
)
throws
Exception
{
final
RequestConfig
.
Builder
builder
=
RequestConfig
.
custom
();
IClientConfig
config
=
configOverride
!=
null
?
configOverride
:
this
.
config
;
if
(
config
!=
null
)
{
builder
.
setConnectTimeout
(
config
.
get
(
CommonClientConfigKey
.
ConnectTimeout
,
this
.
connectTimeout
));
builder
.
setSocketTimeout
(
config
.
get
(
CommonClientConfigKey
.
ReadTimeout
,
this
.
readTimeout
));
builder
.
setRedirectsEnabled
(
config
.
get
(
CommonClientConfigKey
.
FollowRedirects
,
this
.
followRedirects
));
}
else
{
builder
.
setConnectTimeout
(
this
.
connectTimeout
);
builder
.
setSocketTimeout
(
this
.
readTimeout
);
builder
.
setRedirectsEnabled
(
this
.
followRedirects
);
}
final
RequestConfig
requestConfig
=
builder
.
build
();
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/okhttp/OkHttpLoadBalancingClient.java
View file @
9da71b16
...
...
@@ -16,15 +16,17 @@
package
org
.
springframework
.
cloud
.
netflix
.
ribbon
.
okhttp
;
import
java.net.URI
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
java.net.URI
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.cloud.netflix.ribbon.ServerIntrospector
;
import
org.springframework.cloud.netflix.ribbon.support.AbstractLoadBalancingClient
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
com.netflix.client.config.CommonClientConfigKey
;
import
com.netflix.client.config.IClientConfig
;
import
com.netflix.loadbalancer.ILoadBalancer
;
...
...
@@ -84,7 +86,6 @@ public class OkHttpLoadBalancingClient
OkHttpClient
getOkHttpClient
(
IClientConfig
configOverride
,
boolean
secure
)
{
OkHttpClient
.
Builder
builder
=
this
.
delegate
.
newBuilder
();
IClientConfig
config
=
configOverride
!=
null
?
configOverride
:
this
.
config
;
if
(
config
!=
null
)
{
builder
.
connectTimeout
(
config
.
get
(
CommonClientConfigKey
.
ConnectTimeout
,
this
.
connectTimeout
),
TimeUnit
.
MILLISECONDS
);
builder
.
readTimeout
(
config
.
get
(
...
...
@@ -95,15 +96,6 @@ public class OkHttpLoadBalancingClient
builder
.
followSslRedirects
(
configOverride
.
get
(
CommonClientConfigKey
.
FollowRedirects
,
this
.
followRedirects
));
}
}
else
{
builder
.
connectTimeout
(
this
.
connectTimeout
,
TimeUnit
.
MILLISECONDS
);
builder
.
readTimeout
(
this
.
readTimeout
,
TimeUnit
.
MILLISECONDS
);
builder
.
followRedirects
(
this
.
followRedirects
);
if
(
secure
)
{
builder
.
followSslRedirects
(
this
.
followRedirects
);
}
}
return
builder
.
build
();
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/okhttp/OkHttpLoadBalancingClientTests.java
View file @
9da71b16
...
...
@@ -16,6 +16,8 @@
package
org
.
springframework
.
cloud
.
netflix
.
ribbon
.
okhttp
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
okhttp3.OkHttpClient
;
import
org.junit.Test
;
...
...
@@ -24,12 +26,11 @@ import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
com.netflix.client.config.CommonClientConfigKey
;
import
com.netflix.client.config.DefaultClientConfigImpl
;
import
com.netflix.client.config.IClientConfig
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* @author Spencer Gibb
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment