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
e1df7c3b
Unverified
Commit
e1df7c3b
authored
Jun 24, 2016
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back RestClientRibbonCommand api's.
parent
7c2f8067
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
10 deletions
+64
-10
RestClientRibbonCommand.java
...d/netflix/zuul/filters/route/RestClientRibbonCommand.java
+41
-1
RestClientRibbonCommandFactory.java
...ix/zuul/filters/route/RestClientRibbonCommandFactory.java
+6
-9
RibbonCommandContext.java
...loud/netflix/zuul/filters/route/RibbonCommandContext.java
+9
-0
AbstractRibbonCommand.java
...lix/zuul/filters/route/support/AbstractRibbonCommand.java
+8
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommand.java
View file @
e1df7c3b
...
...
@@ -21,7 +21,10 @@ import com.netflix.client.http.HttpRequest;
import
com.netflix.client.http.HttpResponse
;
import
com.netflix.niws.client.http.RestClient
;
import
org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand
;
import
org.springframework.util.MultiValueMap
;
import
java.io.InputStream
;
import
java.net.URI
;
import
java.util.List
;
/**
...
...
@@ -34,6 +37,14 @@ import java.util.List;
@SuppressWarnings
(
"deprecation"
)
public
class
RestClientRibbonCommand
extends
AbstractRibbonCommand
<
RestClient
,
HttpRequest
,
HttpResponse
>
{
@SuppressWarnings
(
"unused"
)
@Deprecated
public
RestClientRibbonCommand
(
String
commandKey
,
RestClient
restClient
,
HttpRequest
.
Verb
verb
,
String
uri
,
Boolean
retryable
,
MultiValueMap
<
String
,
String
>
headers
,
MultiValueMap
<
String
,
String
>
params
,
InputStream
requestEntity
)
{
this
(
commandKey
,
restClient
,
new
RibbonCommandContext
(
commandKey
,
verb
.
verb
(),
uri
,
retryable
,
headers
,
params
,
requestEntity
));
}
public
RestClientRibbonCommand
(
String
commandKey
,
RestClient
client
,
RibbonCommandContext
context
)
{
super
(
commandKey
,
client
,
context
);
}
...
...
@@ -41,7 +52,7 @@ public class RestClientRibbonCommand extends AbstractRibbonCommand<RestClient, H
@Override
protected
HttpRequest
createRequest
()
throws
Exception
{
HttpRequest
.
Builder
builder
=
HttpRequest
.
newBuilder
()
.
verb
(
RestClientRibbonCommandFactory
.
getVerb
(
this
.
context
.
getMethod
()))
.
verb
(
getVerb
(
this
.
context
.
getMethod
()))
.
uri
(
this
.
context
.
uri
())
.
entity
(
this
.
context
.
getRequestEntity
());
...
...
@@ -62,6 +73,35 @@ public class RestClientRibbonCommand extends AbstractRibbonCommand<RestClient, H
}
}
customizeRequest
(
builder
);
return
builder
.
build
();
}
protected
void
customizeRequest
(
HttpRequest
.
Builder
requestBuilder
)
{
// noop
}
@Deprecated
public
URI
getUri
()
{
return
this
.
context
.
uri
();
}
@SuppressWarnings
(
"unused"
)
@Deprecated
public
HttpRequest
.
Verb
getVerb
()
{
return
getVerb
(
this
.
context
.
getVerb
());
}
protected
static
HttpRequest
.
Verb
getVerb
(
String
method
)
{
if
(
method
==
null
)
return
HttpRequest
.
Verb
.
GET
;
try
{
return
HttpRequest
.
Verb
.
valueOf
(
method
.
toUpperCase
());
}
catch
(
IllegalArgumentException
e
)
{
return
HttpRequest
.
Verb
.
GET
;
}
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommandFactory.java
View file @
e1df7c3b
...
...
@@ -41,14 +41,11 @@ public class RestClientRibbonCommandFactory implements RibbonCommandFactory<Rest
return
new
RestClientRibbonCommand
(
context
.
getServiceId
(),
restClient
,
context
);
}
static
HttpRequest
.
Verb
getVerb
(
String
method
)
{
if
(
method
==
null
)
return
HttpRequest
.
Verb
.
GET
;
try
{
return
HttpRequest
.
Verb
.
valueOf
(
method
.
toUpperCase
());
}
catch
(
IllegalArgumentException
e
)
{
return
HttpRequest
.
Verb
.
GET
;
}
public
SpringClientFactory
getClientFactory
()
{
return
clientFactory
;
}
protected
static
HttpRequest
.
Verb
getVerb
(
String
method
)
{
return
RestClientRibbonCommand
.
getVerb
(
method
);
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonCommandContext.java
View file @
e1df7c3b
...
...
@@ -47,4 +47,13 @@ public class RibbonCommandContext {
}
return
null
;
}
/**
* Use getMethod()
* @return
*/
@Deprecated
public
String
getVerb
()
{
return
this
.
method
;
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/support/AbstractRibbonCommand.java
View file @
e1df7c3b
...
...
@@ -96,5 +96,13 @@ public abstract class AbstractRibbonCommand<LBC extends AbstractLoadBalancerAwar
return
new
RibbonHttpResponse
(
response
);
}
public
LBC
getClient
()
{
return
client
;
}
public
RibbonCommandContext
getContext
()
{
return
context
;
}
protected
abstract
RQ
createRequest
()
throws
Exception
;
}
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