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
cb7be89c
Commit
cb7be89c
authored
Jul 10, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化异常抛出
parent
db9b63cd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
+5
-3
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
+2
-3
No files found.
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
View file @
cb7be89c
...
...
@@ -60,7 +60,9 @@ public class ConfigEndpoint implements MvcEndpoint {
public
ResponseEntity
<?>
sendAsync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"Message"
,
"Discovery control is disabled"
),
HttpStatus
.
NOT_FOUND
);
// return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
}
try
{
...
...
@@ -82,7 +84,7 @@ public class ConfigEndpoint implements MvcEndpoint {
public
ResponseEntity
<?>
sendSync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"Message"
,
"Discovery control is disabled"
),
HttpStatus
.
NOT_FOUND
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
}
try
{
...
...
@@ -120,7 +122,7 @@ public class ConfigEndpoint implements MvcEndpoint {
message
=
"An internal error occurred while processing your request\n"
+
message
;
return
new
ResponseEntity
<
String
>(
message
,
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
message
);
}
@Override
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
View file @
cb7be89c
...
...
@@ -14,7 +14,6 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -56,7 +55,7 @@ public class VersionEndpoint implements MvcEndpoint {
public
ResponseEntity
<?>
send
(
@RequestBody
@ApiParam
(
value
=
"版本号"
,
required
=
true
)
String
version
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"Message"
,
"Discovery control is disabled"
),
HttpStatus
.
NOT_FOUND
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
}
pluginEventWapper
.
fireVersionChanged
(
new
VersionChangedEvent
(
VersionChangedEvent
.
EventType
.
VERSION_UPDATE
,
version
),
true
);
...
...
@@ -71,7 +70,7 @@ public class VersionEndpoint implements MvcEndpoint {
public
ResponseEntity
<?>
clear
()
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"Message"
,
"Discovery control is disabled"
),
HttpStatus
.
NOT_FOUND
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
}
pluginEventWapper
.
fireVersionChanged
(
new
VersionChangedEvent
(
VersionChangedEvent
.
EventType
.
VERSION_CLEAR
),
true
);
...
...
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