类 AbstractSentinelInterceptor
java.lang.Object
com.alibaba.csp.sentinel.adapter.spring.webmvc.AbstractSentinelInterceptor
- 所有已实现的接口:
org.springframework.web.servlet.HandlerInterceptor
public abstract class AbstractSentinelInterceptor
extends Object
implements org.springframework.web.servlet.HandlerInterceptor
Since request may be reprocessed in flow if any forwarding or including or other action
happened (see
ServletRequest.getDispatcherType()) we will only
deal with the initial request. So we use reference count to track in
dispathing "onion" though which we could figure out whether we are in initial type "REQUEST".
That means the sub-requests which we rarely meet in practice will NOT be recorded in Sentinel.
How to implement a forward sub-request in your action:
initalRequest() {
ModelAndView mav = new ModelAndView();
mav.setViewName("another");
return mav;
}
- 从以下版本开始:
- 1.7.1
- 作者:
- kaizi2009
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidafterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex) protected StringgetContextName(jakarta.servlet.http.HttpServletRequest request) Return the context name of the target web resource.protected com.alibaba.csp.sentinel.EntrygetEntryInRequest(jakarta.servlet.http.HttpServletRequest request, String attrKey) protected abstract StringgetResourceName(jakarta.servlet.http.HttpServletRequest request) Return the resource name of the target web resource.protected voidhandleBlockException(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, com.alibaba.csp.sentinel.slots.block.BlockException e) protected StringparseOrigin(jakarta.servlet.http.HttpServletRequest request) voidpostHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) booleanpreHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) protected voidremoveEntryInRequest(jakarta.servlet.http.HttpServletRequest request) protected voidtraceExceptionAndExit(com.alibaba.csp.sentinel.Entry entry, Exception ex)
-
字段详细资料
-
SENTINEL_SPRING_WEB_CONTEXT_NAME
- 另请参阅:
-
-
构造器详细资料
-
AbstractSentinelInterceptor
-
-
方法详细资料
-
preHandle
public boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) throws Exception - 指定者:
preHandle在接口中org.springframework.web.servlet.HandlerInterceptor- 抛出:
Exception
-
getResourceName
Return the resource name of the target web resource.- 参数:
request- web request- 返回:
- the resource name of the target web resource.
-
getContextName
Return the context name of the target web resource.- 参数:
request- web request- 返回:
- the context name of the target web resource.
-
afterCompletion
public void afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex) throws Exception - 指定者:
afterCompletion在接口中org.springframework.web.servlet.HandlerInterceptor- 抛出:
Exception
-
postHandle
public void postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception - 指定者:
postHandle在接口中org.springframework.web.servlet.HandlerInterceptor- 抛出:
Exception
-
getEntryInRequest
protected com.alibaba.csp.sentinel.Entry getEntryInRequest(jakarta.servlet.http.HttpServletRequest request, String attrKey) -
removeEntryInRequest
protected void removeEntryInRequest(jakarta.servlet.http.HttpServletRequest request) -
traceExceptionAndExit
-
handleBlockException
protected void handleBlockException(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, com.alibaba.csp.sentinel.slots.block.BlockException e) throws Exception - 抛出:
Exception
-
parseOrigin
-