Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
78333db5
Commit
78333db5
authored
Jul 06, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户查询列表
parent
21cc7cbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
37 deletions
+37
-37
smart-gateway/src/main/java/com/mortals/xhx/base/framework/filter/ForwardAuthFilter.java
.../mortals/xhx/base/framework/filter/ForwardAuthFilter.java
+1
-1
smart-gateway/src/main/java/com/mortals/xhx/base/framework/handler/SentinelFallbackHandler.java
...s/xhx/base/framework/handler/SentinelFallbackHandler.java
+36
-36
No files found.
smart-gateway/src/main/java/com/mortals/xhx/base/framework/filter/ForwardAuthFilter.java
View file @
78333db5
...
@@ -14,7 +14,7 @@ import reactor.core.publisher.Mono;
...
@@ -14,7 +14,7 @@ import reactor.core.publisher.Mono;
* @author: zxfei
* @author: zxfei
* @date: 2022/6/20 16:57
* @date: 2022/6/20 16:57
*/
*/
@Component
//
@Component
public
class
ForwardAuthFilter
implements
GlobalFilter
{
public
class
ForwardAuthFilter
implements
GlobalFilter
{
@Override
@Override
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
GatewayFilterChain
chain
)
{
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
GatewayFilterChain
chain
)
{
...
...
smart-gateway/src/main/java/com/mortals/xhx/base/framework/handler/SentinelFallbackHandler.java
View file @
78333db5
package
com.mortals.xhx.base.framework.handler
;
//
package com.mortals.xhx.base.framework.handler;
//
import
com.mortals.xhx.common.utils.WebFluxUtils
;
//
import com.mortals.xhx.common.utils.WebFluxUtils;
import
org.springframework.web.reactive.function.server.ServerResponse
;
//
import org.springframework.web.reactive.function.server.ServerResponse;
import
org.springframework.web.server.ServerWebExchange
;
//
import org.springframework.web.server.ServerWebExchange;
import
org.springframework.web.server.WebExceptionHandler
;
//
import org.springframework.web.server.WebExceptionHandler;
import
reactor.core.publisher.Mono
;
//
import reactor.core.publisher.Mono;
//
/**
/
//
**
* 自定义限流异常处理
//
* 自定义限流异常处理
*
//
*
* @author: zxfei
//
* @author: zxfei
* @date: 2022/6/20 13:53
//
* @date: 2022/6/20 13:53
*/
//
*/
public
class
SentinelFallbackHandler
implements
WebExceptionHandler
{
//
public class SentinelFallbackHandler implements WebExceptionHandler {
private
Mono
<
Void
>
writeResponse
(
ServerResponse
response
,
ServerWebExchange
exchange
)
{
//
private Mono<Void> writeResponse(ServerResponse response, ServerWebExchange exchange) {
return
WebFluxUtils
.
webFluxResponseWriter
(
exchange
.
getResponse
(),
"请求超过最大数,请稍候再试"
);
//
return WebFluxUtils.webFluxResponseWriter(exchange.getResponse(), "请求超过最大数,请稍候再试");
}
//
}
//
@Override
//
@Override
public
Mono
<
Void
>
handle
(
ServerWebExchange
exchange
,
Throwable
ex
)
{
//
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
ex
.
printStackTrace
();
//
ex.printStackTrace();
if
(
exchange
.
getResponse
().
isCommitted
())
{
//
if (exchange.getResponse().isCommitted()) {
return
Mono
.
error
(
ex
);
//
return Mono.error(ex);
}
//
}
return
null
;
//
return null;
/* if (!BlockException.isBlockException(ex)) {
/
//
* if (!BlockException.isBlockException(ex)) {
return Mono.error(ex);
//
return Mono.error(ex);
}
//
}
return handleBlockedRequest(exchange, ex).flatMap(response -> writeResponse(response, exchange));*/
//
return handleBlockedRequest(exchange, ex).flatMap(response -> writeResponse(response, exchange));*/
}
//
}
//
/* private Mono<ServerResponse> handleBlockedRequest(ServerWebExchange exchange, Throwable throwable) {
/
//
* private Mono<ServerResponse> handleBlockedRequest(ServerWebExchange exchange, Throwable throwable) {
return GatewayCallbackManager.getBlockHandler().handleRequest(exchange, throwable);
//
return GatewayCallbackManager.getBlockHandler().handleRequest(exchange, throwable);
}*/
//
}*/
}
//
}
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