Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
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
apollo
Commits
57539118
Commit
57539118
authored
Oct 12, 2017
by
Jason Song
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #784 from Acceml/humingreq
use java8 api to replace guava joining List to String
parents
87b70240
402297d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
ConfigController.java
...ork/apollo/configservice/controller/ConfigController.java
+4
-6
No files found.
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigController.java
100644 → 100755
View file @
57539118
...
...
@@ -5,6 +5,7 @@ import java.lang.reflect.Type;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -26,10 +27,8 @@ import com.ctrip.framework.apollo.core.ConfigConsts;
import
com.ctrip.framework.apollo.core.dto.ApolloConfig
;
import
com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Splitter
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.gson.Gson
;
...
...
@@ -56,7 +55,6 @@ public class ConfigController {
private
static
final
Type
configurationTypeReference
=
new
TypeToken
<
Map
<
String
,
String
>>()
{
}.
getType
();
private
static
final
Joiner
STRING_JOINER
=
Joiner
.
on
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
);
@RequestMapping
(
value
=
"/{appId}/{clusterName}/{namespace:.+}"
,
method
=
RequestMethod
.
GET
)
public
ApolloConfig
queryConfig
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
...
...
@@ -113,8 +111,8 @@ public class ConfigController {
auditReleases
(
appId
,
clusterName
,
dataCenter
,
clientIp
,
releases
);
String
mergedReleaseKey
=
FluentIterable
.
from
(
releases
).
transform
(
input
->
input
.
getReleaseKey
()).
join
(
STRING_JOINER
);
String
mergedReleaseKey
=
releases
.
stream
().
map
(
Release:
:
getReleaseKey
)
.
collect
(
Collectors
.
joining
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
)
);
if
(
mergedReleaseKey
.
equals
(
clientSideReleaseKey
))
{
// Client side configuration is the same with server side, return 304
...
...
@@ -186,7 +184,7 @@ public class ConfigController {
if
(!
Strings
.
isNullOrEmpty
(
dataCenter
))
{
keyParts
.
add
(
dataCenter
);
}
return
STRING_JOINER
.
join
(
keyParts
);
return
keyParts
.
stream
().
collect
(
Collectors
.
joining
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
)
);
}
private
void
auditReleases
(
String
appId
,
String
cluster
,
String
dataCenter
,
String
clientIp
,
...
...
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