Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
eca3dde6
Commit
eca3dde6
authored
Aug 21, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构策略模块
parent
37c41831
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
36 deletions
+6
-36
discovery-plugin-strategy-extension-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/extension/gateway/adapter/VersionDiscoveryEnabledAdapter.java
+2
-12
discovery-plugin-strategy-extension-service/src/main/java/com/nepxion/discovery/plugin/strategy/extension/service/adapter/VersionDiscoveryEnabledAdapter.java
+2
-12
discovery-plugin-strategy-extension-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/extension/zuul/adapter/VersionDiscoveryEnabledAdapter.java
+2
-12
No files found.
discovery-plugin-strategy-extension-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/extension/gateway/adapter/VersionDiscoveryEnabledAdapter.java
View file @
eca3dde6
...
...
@@ -9,8 +9,6 @@ package com.nepxion.discovery.plugin.strategy.extension.gateway.adapter;
* @version 1.0
*/
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
com.nepxion.discovery.common.constant.DiscoveryConstant
;
import
com.nepxion.discovery.plugin.strategy.adapter.AbstractVersionDiscoveryEnabledAdapter
;
import
com.nepxion.discovery.plugin.strategy.extension.gateway.context.GatewayStrategyContext
;
...
...
@@ -18,17 +16,8 @@ import com.nepxion.discovery.plugin.strategy.extension.gateway.context.GatewaySt
public
class
VersionDiscoveryEnabledAdapter
extends
AbstractVersionDiscoveryEnabledAdapter
{
@Override
protected
String
getVersionJson
()
{
ServerHttpRequest
request
=
getRequest
();
if
(
request
==
null
)
{
return
null
;
}
return
request
.
getHeaders
().
getFirst
(
DiscoveryConstant
.
VERSION
);
}
public
ServerHttpRequest
getRequest
()
{
GatewayStrategyContext
context
=
GatewayStrategyContext
.
getCurrentContext
();
return
context
.
getExchange
().
getRequest
();
return
context
.
getExchange
().
getRequest
()
.
getHeaders
().
getFirst
(
DiscoveryConstant
.
VERSION
)
;
}
}
\ No newline at end of file
discovery-plugin-strategy-extension-service/src/main/java/com/nepxion/discovery/plugin/strategy/extension/service/adapter/VersionDiscoveryEnabledAdapter.java
View file @
eca3dde6
...
...
@@ -9,8 +9,6 @@ package com.nepxion.discovery.plugin.strategy.extension.service.adapter;
* @version 1.0
*/
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -20,20 +18,11 @@ import com.nepxion.discovery.plugin.strategy.adapter.AbstractVersionDiscoveryEna
public
class
VersionDiscoveryEnabledAdapter
extends
AbstractVersionDiscoveryEnabledAdapter
{
@Override
protected
String
getVersionJson
()
{
HttpServletRequest
request
=
getRequest
();
if
(
request
==
null
)
{
return
null
;
}
return
request
.
getHeader
(
DiscoveryConstant
.
VERSION
);
}
public
HttpServletRequest
getRequest
()
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
attributes
==
null
)
{
return
null
;
}
return
attributes
.
getRequest
();
return
attributes
.
getRequest
()
.
getHeader
(
DiscoveryConstant
.
VERSION
)
;
}
}
\ No newline at end of file
discovery-plugin-strategy-extension-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/extension/zuul/adapter/VersionDiscoveryEnabledAdapter.java
View file @
eca3dde6
...
...
@@ -9,8 +9,6 @@ package com.nepxion.discovery.plugin.strategy.extension.zuul.adapter;
* @version 1.0
*/
import
javax.servlet.http.HttpServletRequest
;
import
com.nepxion.discovery.common.constant.DiscoveryConstant
;
import
com.nepxion.discovery.plugin.strategy.adapter.AbstractVersionDiscoveryEnabledAdapter
;
import
com.netflix.zuul.context.RequestContext
;
...
...
@@ -18,17 +16,8 @@ import com.netflix.zuul.context.RequestContext;
public
class
VersionDiscoveryEnabledAdapter
extends
AbstractVersionDiscoveryEnabledAdapter
{
@Override
protected
String
getVersionJson
()
{
HttpServletRequest
request
=
getRequest
();
if
(
request
==
null
)
{
return
null
;
}
return
request
.
getHeader
(
DiscoveryConstant
.
VERSION
);
}
public
HttpServletRequest
getRequest
()
{
RequestContext
context
=
RequestContext
.
getCurrentContext
();
return
context
.
getRequest
();
return
context
.
getRequest
()
.
getHeader
(
DiscoveryConstant
.
VERSION
)
;
}
}
\ No newline at end of file
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