Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mqtt Cluster
Commits
ca6fb5e7
Commit
ca6fb5e7
authored
3 years ago
by
Easy
Browse files
Options
Download
Email Patches
Plain Diff
转换了接口返回格式
parent
d938bd0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smqtt-core/src/main/java/io/github/quickmsg/core/http/acl/AclQueryPolicyActor.java
+14
-8
...io/github/quickmsg/core/http/acl/AclQueryPolicyActor.java
with
14 additions
and
8 deletions
+14
-8
smqtt-core/src/main/java/io/github/quickmsg/core/http/acl/AclQueryPolicyActor.java
+
14
-
8
View file @
ca6fb5e7
...
...
@@ -16,6 +16,10 @@ import reactor.netty.http.server.HttpServerRequest;
import
reactor.netty.http.server.HttpServerResponse
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author luxurong
...
...
@@ -29,14 +33,16 @@ public class AclQueryPolicyActor extends AbstractHttpActor {
@Override
public
Publisher
<
Void
>
doRequest
(
HttpServerRequest
request
,
HttpServerResponse
response
,
Configuration
configuration
)
{
return
request
.
receive
()
.
asString
(
StandardCharsets
.
UTF_8
)
.
map
(
this
.
toJson
(
PolicyModel
.
class
))
.
doOnNext
(
policyModel
->
response
.
sendString
(
Mono
.
just
(
JacksonUtil
.
bean2Json
(
ContextHolder
.
getReceiveContext
().
getAclManager
().
get
(
policyModel
)))).
then
().
subscribe
()
)
.
then
();
return
request
.
receive
().
asString
(
StandardCharsets
.
UTF_8
).
map
(
this
.
toJson
(
PolicyModel
.
class
)).
doOnNext
(
policyModel
->
{
List
<
Map
<
String
,
Object
>>
collect
=
ContextHolder
.
getReceiveContext
().
getAclManager
().
get
(
policyModel
).
stream
().
map
(
item
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"subject"
,
item
.
size
()
>=
3
?
item
.
get
(
0
)
:
null
);
map
.
put
(
"source"
,
item
.
size
()
>=
3
?
item
.
get
(
1
)
:
null
);
map
.
put
(
"action"
,
item
.
size
()
>=
3
?
item
.
get
(
2
)
:
null
);
return
map
;
}).
collect
(
Collectors
.
toList
());
response
.
sendString
(
Mono
.
just
(
JacksonUtil
.
bean2Json
(
collect
))).
then
().
subscribe
();
}).
then
();
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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