Package com.bytedesk.core.aop
Class BlackIpAspect
java.lang.Object
com.bytedesk.core.aop.BlackIpAspect
黑名单ip拦截器
注意:不能在类上注解@Async,否则会获取不到 HttpServletRequest,attributes为空。
如果不需要HttpServletRequest,可以添加@Async注解
- Author:
- jackning
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
containsBlackIp
(String messageJson) void
doAfterReturning
(org.aspectj.lang.JoinPoint joinPoint, BlackIpFilter blackIpFilter, Object jsonResult) 处理完请求后执行void
doAfterThrowing
(org.aspectj.lang.JoinPoint joinPoint, BlackIpFilter blackIpFilter, Exception e) 拦截异常操作void
doBefore
(org.aspectj.lang.JoinPoint joinPoint, BlackIpFilter blackIpFilter) 处理请求前执行
-
Field Details
-
request
private final jakarta.servlet.http.HttpServletRequest request
-
-
Constructor Details
-
BlackIpAspect
public BlackIpAspect()
-
-
Method Details
-
doBefore
处理请求前执行 -
doAfterReturning
public void doAfterReturning(org.aspectj.lang.JoinPoint joinPoint, BlackIpFilter blackIpFilter, Object jsonResult) 处理完请求后执行- Parameters:
joinPoint
- 切点
-
doAfterThrowing
public void doAfterThrowing(org.aspectj.lang.JoinPoint joinPoint, BlackIpFilter blackIpFilter, Exception e) 拦截异常操作- Parameters:
joinPoint
- 切点e
- 异常
-
containsBlackIp
- Parameters:
message
- 消息内容- Returns:
- 是否包含黑名单IP
-