クラス PathPatternRequestMatcher

java.lang.ObjectSE
org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher
実装済みのインターフェース一覧:
RequestMatcher

public final class PathPatternRequestMatcher extends ObjectSE implements RequestMatcher
PathPattern を使用して各 HttpServletRequest と照合する RequestMatcher。指定するパスはコンテキストパスを基準にする必要があります (つまり、コンテキストパスを除外する必要があります)。

PathPatternRequestMatcher.Builder.basePath でサーブレットパスを提供し、複数のマッチャーで再利用できます。

関連する URI パターンを含む HandlerMapping は PathPatternParser.defaultInstance を使用している必要があることに注意してください。そうでない場合は、PathPatternParser を使用してパスを解析し、コンストラクターで PathPattern を提供します。

導入:
6.5
  • 方法の詳細

    • pathPattern

      public static PathPatternRequestMatcher pathPattern(StringSE pattern)
      PathPatternParser のデフォルトを使用して PathPatternRequestMatcher を構築します。

      カスタム PathPatternParser を構成する場合は、代わりに withPathPatternParser(PathPatternParser) を使用してください。

      パラメーター:
      pattern - 一致する URI パターン
      戻り値:
      指定された pattern へのリクエストをマッチングする PathPatternRequestMatcher
      導入:
      7.0
      関連事項:
      • PathPattern
    • pathPattern

      public static PathPatternRequestMatcher pathPattern(@Nullable org.springframework.http.HttpMethod method, StringSE pattern)
      PathPatternParser のデフォルトを使用して PathPatternRequestMatcher を構築します。

      カスタム PathPatternParser を構成する場合は、代わりに withPathPatternParser(PathPatternParser) を使用してください。

      パラメーター:
      method - 一致する HTTP メソッド、null はメソッドが重要ではないことを示します
      pattern - 一致する URI パターン
      戻り値:
      指定された pattern および method へのリクエストに一致する PathPatternRequestMatcher
      導入:
      7.0
      関連事項:
      • PathPattern
    • withDefaults

      public static PathPatternRequestMatcher.Builder withDefaults()
      PathPatternParser.defaultInstance を使用してパスパターンを解析します。
      戻り値:
      URI をコンテキストパス(存在する場合)に対する相対パスとして扱う PathPatternRequestMatcher.Builder
    • withPathPatternParser

      public static PathPatternRequestMatcher.Builder withPathPatternParser(org.springframework.web.util.pattern.PathPatternParser parser)
      この PathPatternParser を使用してパスパターンを解析します。
      パラメーター:
      parser - 使用する PathPatternParser 
      戻り値:
      URI を指定された servletPath に相対的なものとして扱う PathPatternRequestMatcher.Builder
    • matches

      public boolean matches(jakarta.servlet.http.HttpServletRequest request)
      戦略によって実装されたルールが提供されたリクエストと一致するかどうかを決定します。
      次で指定:
      インターフェース RequestMatcher 内の matches 
      パラメーター:
      request - 一致を確認するリクエスト
      戻り値:
      リクエストが一致する場合は true、そうでない場合は false
    • matcher

      public RequestMatcher.MatchResult matcher(jakarta.servlet.http.HttpServletRequest request)
      この RequestMatcher の MatchResult を返します。デフォルトの実装では、RequestMatcher.MatchResult.getVariables() が呼び出されると Collections.emptyMap() が返されます。
      次で指定:
      インターフェース RequestMatcher 内の matcher 
      戻り値:
      MatchResult は、この RequestMatcher を HttpServletRequest と比較します
    • equals

      public boolean equals(@Nullable ObjectSE o)
      オーバーライド:
      クラス ObjectSE の equalsSE 
    • hashCode

      public int hashCode()
      オーバーライド:
      クラス ObjectSE の hashCode 
    • toString

      public StringSE toString()
      オーバーライド:
      クラス ObjectSE の toString