public abstract class ServletRequestPathUtils extends ObjectSE
parsed patterns
の使用が有効になっている場合のパスの解析済み RequestPath
表現、またはそれ以外の場合は PathMatcher
で使用するための文字列パスの場合があります。修飾子と型 | フィールドと説明 |
---|---|
static StringSE | PATH_ATTRIBUTE 解析された RequestPath を保持するサーブレットリクエスト属性の名前。 |
コンストラクターと説明 |
---|
ServletRequestPathUtils() |
修飾子と型 | メソッドと説明 |
---|---|
static void | clearParsedRequestPath(ServletRequestEE request) |
static ObjectSE | getCachedPath(ServletRequestEE request) |
static StringSE | getCachedPathValue(ServletRequestEE request) リクエストマッピングのパスを文字列として返す getCachedPath(ServletRequest) のバリアント。 |
static RequestPath | getParsedRequestPath(ServletRequestEE request) 解析およびキャッシュされた RequestPath の previously を返します。 |
static boolean | hasCachedPath(ServletRequestEE request) |
static boolean | hasParsedRequestPath(ServletRequestEE request) 解析およびキャッシュされた RequestPath の previously を確認します。 |
static RequestPath | parseAndCache(HttpServletRequestEE request) |
static void | setParsedRequestPath(RequestPath requestPath, ServletRequestEE request) キャッシュされ、解析された RequestPath を指定された値に設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static final StringSE PATH_ATTRIBUTE
RequestPath
を保持するサーブレットリクエスト属性の名前。public static RequestPath parseAndCache(HttpServletRequestEE request)
requestURI
EE を RequestPath
に解析し、後で parsed patterns
で使用できるように、リクエスト属性 PATH_ATTRIBUTE
に保存します。 返される RequestPath
には、contextPath と、公開する pathWithinApplication
から省略された servletPath プレフィックスの両方が含まれます。
このメソッドは通常、DispatcherServlet
によって呼び出され、解析されたパターンを使用していることを HandlerMapping
が示しているかどうかを判別します。その後、事前に解析およびキャッシュされた RequestPath
に getParsedRequestPath(ServletRequest)
を介してアクセスできます。
public static RequestPath getParsedRequestPath(ServletRequestEE request)
RequestPath
の previously
を返します。IllegalArgumentExceptionSE
- 見つからない場合 public static void setParsedRequestPath(@Nullable RequestPath requestPath, ServletRequestEE request)
RequestPath
を指定された値に設定します。requestPath
- 設定する値、または null
の場合はキャッシュ値がクリアされます。request
- 現在のリクエスト public static boolean hasParsedRequestPath(ServletRequestEE request)
RequestPath
の previously
を確認します。public static void clearParsedRequestPath(ServletRequestEE request)
public static ObjectSE getCachedPath(ServletRequestEE request)
pre-resolved
文字列 lookupPath または pre-parsed
RequestPath
を返します。Spring MVC では、少なくとも 1 つの HandlerMapping
が PathPatterns
を有効に解析している場合、DispatcherServlet
は RequestPath
を先行して解析してキャッシュします。これは、ServletRequestPathFilter
を使用して以前に行うこともできます。HandlerMapping
が PathMatcher
との文字列パターンマッチングを使用するその他の場合、文字列 lookupPath は各 HandlerMapping
によって個別に解決されます。
request
- 現在のリクエスト RequestPath
IllegalArgumentExceptionSE
- どちらも利用できない場合 public static StringSE getCachedPathValue(ServletRequestEE request)
getCachedPath(ServletRequest)
のバリアント。 キャッシュされたパスが pre-parsed
RequestPath
の場合、返される文字列パス値はエンコードされ、パスパラメーターが削除されます。
キャッシュされたパスが pre-resolved
文字列 lookupPath の場合、返される文字列パス値は、解決された UrlPathHelper
の構成方法によって異なります。
request
- 現在のリクエスト public static boolean hasCachedPath(ServletRequestEE request)
request
- 現在のリクエスト