Class AbstractHandlerInterceptor

java.lang.Object
net.guerlab.cloud.auth.webmvc.interceptor.AbstractHandlerInterceptor
All Implemented Interfaces:
org.springframework.core.Ordered, org.springframework.web.servlet.HandlerInterceptor
Direct Known Subclasses:
AbstractTokenHandlerInterceptor

public abstract class AbstractHandlerInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor, org.springframework.core.Ordered
抽象拦截器处理.
Author:
guer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    默认排序.
    protected final net.guerlab.cloud.web.core.properties.ResponseAdvisorProperties
    http响应数据处理配置参数.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractHandlerInterceptor(net.guerlab.cloud.web.core.properties.ResponseAdvisorProperties responseAdvisorProperties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static <A extends Annotation>
    A
    getAnnotation(org.springframework.web.method.HandlerMethod handlerMethod, Class<A> annotationClass)
    获取注解.
    int
     
    final boolean
    preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
     
    protected void
    获取令牌失败前置处理.
    protected void
    preHandleWithToken(jakarta.servlet.http.HttpServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod, String token, List<Class<?>> targetAuthTypes)
    获取令牌成功前置处理.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor

    afterCompletion, postHandle
  • Field Details

    • DEFAULT_ORDER

      public static final int DEFAULT_ORDER
      默认排序.
      See Also:
    • responseAdvisorProperties

      protected final net.guerlab.cloud.web.core.properties.ResponseAdvisorProperties responseAdvisorProperties
      http响应数据处理配置参数.
  • Constructor Details

    • AbstractHandlerInterceptor

      protected AbstractHandlerInterceptor(net.guerlab.cloud.web.core.properties.ResponseAdvisorProperties responseAdvisorProperties)
  • Method Details

    • getAnnotation

      @Nullable protected static <A extends Annotation> A getAnnotation(org.springframework.web.method.HandlerMethod handlerMethod, Class<A> annotationClass)
      获取注解.
      Type Parameters:
      A - 注解类
      Parameters:
      handlerMethod - 处理方法
      annotationClass - 注解类
      Returns:
      注解对象
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • preHandle

      public final boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
    • preHandleWithToken

      protected void preHandleWithToken(jakarta.servlet.http.HttpServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod, String token, List<Class<?>> targetAuthTypes)
      获取令牌成功前置处理.
      Parameters:
      request - 请求
      handlerMethod - 处理方法
      token - 令牌
      targetAuthTypes - 目标认证类型列表
    • preHandleWithoutToken

      protected void preHandleWithoutToken()
      获取令牌失败前置处理.