クラス ServletRequestPathUtils
java.lang.ObjectSE
org.springframework.web.util.ServletRequestPathUtils
リクエストマッピングの目的でルックアップパスの準備とアクセスを支援するユーティリティクラス。これは、
parsed patterns
の使用が有効になっている場合のパスの解析済み RequestPath
表現、またはそれ以外の場合は PathMatcher
で使用するための文字列パスの場合があります。- 導入:
- 5.3
- 作成者:
- Rossen Stoyanchev, Stephane Nicoll
フィールドサマリー
フィールドコンストラクターのサマリー
コンストラクター方法の概要
修飾子と型メソッド説明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
を指定された値に設定します。
フィールドの詳細
PATH_ATTRIBUTE
解析されたRequestPath
を保持するサーブレットリクエスト属性の名前。
コンストラクターの詳細
ServletRequestPathUtils
public ServletRequestPathUtils()
メソッドの詳細
parseAndCache
requestURI
EE をRequestPath
に解析し、後でparsed patterns
で使用できるように、リクエスト属性PATH_ATTRIBUTE
に保存します。返される
RequestPath
には、公開されるpathWithinApplication
から省略された contextPath と servletPath プレフィックスの両方が含まれます。このメソッドは通常、
DispatcherServlet
によって呼び出され、解析されたパターンを使用していることをHandlerMapping
が示しているかどうかを判別します。その後、事前に解析およびキャッシュされたRequestPath
にgetParsedRequestPath(ServletRequest)
を介してアクセスできます。getParsedRequestPath
解析およびキャッシュされたRequestPath
のpreviously
を返します。- 例外:
IllegalArgumentExceptionSE
- 見つからない場合
setParsedRequestPath
public static void setParsedRequestPath(@Nullable RequestPath requestPath, ServletRequestEE request) キャッシュされ、解析されたRequestPath
を指定された値に設定します。- パラメーター:
requestPath
- 設定する値、またはnull
の場合はキャッシュ値がクリアされます。request
- 現在のリクエスト- 導入:
- 5.3.3
hasParsedRequestPath
解析およびキャッシュされたRequestPath
のpreviously
を確認します。clearParsedRequestPath
getCachedPath
pre-resolved
文字列 lookupPath またはpre-parsed
RequestPath
のいずれかを返します。Spring MVC では、少なくとも 1 つの
HandlerMapping
が解析済みのPathPatterns
を有効にしている場合、DispatcherServlet
はRequestPath
を解析してキャッシュしますが、これはServletRequestPathFilter
でさらに早く実行することもできます。HandlerMapping
がPathMatcher
との文字列パターンマッチングを使用するその他のケースでは、文字列 lookupPath は各HandlerMapping
で個別に解決されます。- パラメーター:
request
- 現在のリクエスト- 戻り値:
- 文字列 lookupPath または
RequestPath
- 例外:
IllegalArgumentExceptionSE
- どちらも利用できない場合
getCachedPathValue
リクエストマッピングのパスを文字列として返すgetCachedPath(ServletRequest)
のバリアント。キャッシュされたパスが
pre-parsed
RequestPath
の場合、返される文字列パス値はエンコードされ、パスパラメーターが削除されます。キャッシュされたパスが
pre-resolved
文字列 lookupPath の場合、返される文字列パス値は、解決されたUrlPathHelper
の構成方法によって異なります。- パラメーター:
request
- 現在のリクエスト- 戻り値:
- 文字列としての完全なリクエストマッピングパス
hasCachedPath
- パラメーター:
request
- 現在のリクエスト- 戻り値:
- 事前に解決されたパスまたは事前に解析されたパスが使用可能かどうか