类 AbstractSentinelInterceptor

java.lang.Object
com.alibaba.csp.sentinel.adapter.spring.webmvc.AbstractSentinelInterceptor
所有已实现的接口:
org.springframework.web.servlet.HandlerInterceptor
直接已知子类:
SentinelWebInterceptor, SentinelWebTotalInterceptor

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
  • 字段详细资料

    • SENTINEL_SPRING_WEB_CONTEXT_NAME

      public static final String SENTINEL_SPRING_WEB_CONTEXT_NAME
      另请参阅:
  • 构造器详细资料

    • AbstractSentinelInterceptor

      public AbstractSentinelInterceptor(BaseWebMvcConfig config)
  • 方法详细资料

    • 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

      protected abstract String getResourceName(jakarta.servlet.http.HttpServletRequest request)
      Return the resource name of the target web resource.
      参数:
      request - web request
      返回:
      the resource name of the target web resource.
    • getContextName

      protected String getContextName(jakarta.servlet.http.HttpServletRequest request)
      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

      protected void traceExceptionAndExit(com.alibaba.csp.sentinel.Entry entry, Exception ex)
    • 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

      protected String parseOrigin(jakarta.servlet.http.HttpServletRequest request)