类 SaRouter

java.lang.Object
cn.dev33.satoken.router.SaRouter

public class SaRouter extends Object
路由匹配操作工具类
作者:
kong
  • 方法详细资料

    • isMatch

      public static boolean isMatch(String pattern, String path)
      路由匹配
      参数:
      pattern - 路由匹配符
      path - 被匹配的路由
      返回:
      是否匹配成功
    • isMatch

      public static boolean isMatch(List<String> patterns, String path)
      路由匹配
      参数:
      patterns - 路由匹配符集合
      path - 被匹配的路由
      返回:
      是否匹配成功
    • isMatch

      public static boolean isMatch(String[] patterns, String path)
      路由匹配
      参数:
      patterns - 路由匹配符数组
      path - 被匹配的路由
      返回:
      是否匹配成功
    • isMatch

      public static boolean isMatch(SaHttpMethod[] methods, String methodString)
      Http请求方法匹配
      参数:
      methods - Http请求方法断言数组
      methodString - Http请求方法
      返回:
      是否匹配成功
    • isMatchCurrURI

      public static boolean isMatchCurrURI(String pattern)
      路由匹配 (使用当前URI)
      参数:
      pattern - 路由匹配符
      返回:
      是否匹配成功
    • isMatchCurrURI

      public static boolean isMatchCurrURI(List<String> patterns)
      路由匹配 (使用当前URI)
      参数:
      patterns - 路由匹配符集合
      返回:
      是否匹配成功
    • isMatchCurrURI

      public static boolean isMatchCurrURI(String[] patterns)
      路由匹配 (使用当前URI)
      参数:
      patterns - 路由匹配符数组
      返回:
      是否匹配成功
    • isMatchCurrMethod

      public static boolean isMatchCurrMethod(SaHttpMethod[] methods)
      Http请求方法匹配 (使用当前请求方式)
      参数:
      methods - Http请求方法断言数组
      返回:
      是否匹配成功
    • newMatch

      public static SaRouterStaff newMatch()
      初始化一个SaRouterStaff,开始匹配
      返回:
      SaRouterStaff
    • match

      public static SaRouterStaff match(String... patterns)
      路由匹配
      参数:
      patterns - 路由匹配符集合
      返回:
      SaRouterStaff
    • notMatch

      public static SaRouterStaff notMatch(String... patterns)
      路由匹配排除
      参数:
      patterns - 路由匹配符排除数组
      返回:
      SaRouterStaff
    • match

      public static SaRouterStaff match(List<String> patterns)
      路由匹配
      参数:
      patterns - 路由匹配符集合
      返回:
      对象自身
    • notMatch

      public static SaRouterStaff notMatch(List<String> patterns)
      路由匹配排除
      参数:
      patterns - 路由匹配符排除集合
      返回:
      对象自身
    • match

      public static SaRouterStaff match(SaHttpMethod... methods)
      Http请求方式匹配 (Enum)
      参数:
      methods - Http请求方法断言数组
      返回:
      SaRouterStaff
    • notMatch

      public static SaRouterStaff notMatch(SaHttpMethod... methods)
      Http请求方法匹配排除 (Enum)
      参数:
      methods - Http请求方法断言排除数组
      返回:
      SaRouterStaff
    • matchMethod

      public static SaRouterStaff matchMethod(String... methods)
      Http请求方法匹配 (String)
      参数:
      methods - Http请求方法断言数组
      返回:
      SaRouterStaff
    • notMatchMethod

      public static SaRouterStaff notMatchMethod(String... methods)
      Http请求方法匹配排除 (String)
      参数:
      methods - Http请求方法断言排除数组
      返回:
      SaRouterStaff
    • match

      public static SaRouterStaff match(boolean flag)
      根据 boolean 值进行匹配
      参数:
      flag - boolean值
      返回:
      SaRouterStaff
    • notMatch

      public static SaRouterStaff notMatch(boolean flag)
      根据 boolean 值进行匹配排除
      参数:
      flag - boolean值
      返回:
      SaRouterStaff
    • match

      public static SaRouterStaff match(SaParamRetFunction<Object,Boolean> fun)
      根据自定义方法进行匹配 (lazy)
      参数:
      fun - 自定义方法
      返回:
      SaRouterStaff
    • notMatch

      public static SaRouterStaff notMatch(SaParamRetFunction<Object,Boolean> fun)
      根据自定义方法进行匹配排除 (lazy)
      参数:
      fun - 自定义排除方法
      返回:
      SaRouterStaff
    • match

      public static SaRouterStaff match(String pattern, SaFunction fun)
      路由匹配,如果匹配成功则执行认证函数
      参数:
      pattern - 路由匹配符
      fun - 要执行的校验方法
      返回:
      /
    • match

      public static SaRouterStaff match(String pattern, SaParamFunction<SaRouterStaff> fun)
      路由匹配,如果匹配成功则执行认证函数
      参数:
      pattern - 路由匹配符
      fun - 要执行的校验方法
      返回:
      /
    • match

      public static SaRouterStaff match(String pattern, String excludePattern, SaFunction fun)
      路由匹配 (并指定排除匹配符),如果匹配成功则执行认证函数
      参数:
      pattern - 路由匹配符
      excludePattern - 要排除的路由匹配符
      fun - 要执行的方法
      返回:
      /
    • match

      public static SaRouterStaff match(String pattern, String excludePattern, SaParamFunction<SaRouterStaff> fun)
      路由匹配 (并指定排除匹配符),如果匹配成功则执行认证函数
      参数:
      pattern - 路由匹配符
      excludePattern - 要排除的路由匹配符
      fun - 要执行的方法
      返回:
      /
    • stop

      public static SaRouterStaff stop()
      停止匹配,跳出函数 (在多个匹配链中一次性跳出Auth函数)
      返回:
      SaRouterStaff
    • back

      public static SaRouterStaff back()
      停止匹配,结束执行,向前端返回结果
      返回:
      SaRouterStaff
    • back

      public static SaRouterStaff back(Object result)
      停止匹配,结束执行,向前端返回结果
      参数:
      result - 要输出的结果
      返回:
      SaRouterStaff