public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping implements MatchableHandlerMapping
HandlerMapping 実装の抽象基本クラス。"/test/*","/test/**" などのリテラル一致とパターン一致をサポートします。パターン構文の詳細については、解析されたパターンが enabled の場合は PathPattern を参照するか、それ以外の場合は AntPathMatcher を参照してください。構文はほぼ同じですが、PathPattern 構文は Web アプリケーション向けに調整されており、その実装はより効率的です。
現在のリクエストパスに最も正確に一致するものを見つけるために、すべてのパスパターンがチェックされます。ここで、「最も正確な」は、現在のリクエストパスに一致する最長のパスパターンです。
loggerBEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTEHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| コンストラクターと説明 |
|---|
AbstractUrlHandlerMapping() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected ObjectSE | buildPathExposingHandler(ObjectSE rawHandler, StringSE bestMatchingPattern, StringSE pathWithinMapping, MapSE<StringSE, StringSE> uriTemplateVariables) ハンドラーを実行する前に、実際のハンドラー HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE と HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE を公開して、指定された生のハンドラーのハンドラーオブジェクトを作成します。 |
protected void | exposePathWithinMapping(StringSE bestMatchingPattern, StringSE pathWithinMapping, HttpServletRequestEE request) 現在のマッピング内のパスをリクエスト属性として公開します。 |
protected void | exposeUriTemplateVariables(MapSE<StringSE, StringSE> uriTemplateVariables, HttpServletRequestEE request)URI テンプレート変数をリクエスト属性として公開します。 |
protected ObjectSE | getHandlerInternal(HttpServletRequestEE request) 指定されたリクエストの URL パスのハンドラーを検索します。 |
MapSE<StringSE, ObjectSE> | getHandlerMap() 登録されたパスまたはパターンをキーとして、ハンドラーオブジェクト(または lazy-init ハンドラーの場合はハンドラー Bean 名)を値として、ハンドラーマッピングを読み取り専用マップとして返します。 |
MapSE<PathPattern, ObjectSE> | getPathPatternHandlerMap()getHandlerMap() と同じですが、解析されたパターンが enabled の場合に入力されます。それ以外の場合は空です。 |
ObjectSE | getRootHandler() このハンドラーマッピングのルートハンドラーを返します(「/"), または null がない場合は登録済み)。 |
protected ObjectSE | lookupHandler(RequestPath path, StringSE lookupPath, HttpServletRequestEE request) 指定された URL パスのハンドラーインスタンスを検索します。 |
protected ObjectSE | lookupHandler(StringSE lookupPath, HttpServletRequestEE request) 指定された URL パスのハンドラーインスタンスを検索します。 |
RequestMatchResult | match(HttpServletRequestEE request, StringSE pattern) リクエストが指定されたパターンに一致するかどうかを判別します。 |
protected void | registerHandler(StringSE[] urlPaths, StringSE beanName) 指定された URL パスに指定されたハンドラーを登録します。 |
protected void | registerHandler(StringSE urlPath, ObjectSE handler) 指定された URL パスに指定されたハンドラーを登録します。 |
void | setLazyInitHandlers(boolean lazyInitHandlers) ハンドラーを遅延初期化するかどうかを設定します。 |
void | setRootHandler(ObjectSE rootHandler) このハンドラーマッピングのルートハンドラー、つまり、ルートパス("/")に登録されるハンドラーを設定します。 |
void | setUseTrailingSlashMatch(boolean useTrailingSlashMatch) 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
protected boolean | supportsTypeLevelMappings() このハンドラーマッピングが型レベルのマッピングをサポートするかどうかを示します。 |
boolean | useTrailingSlashMatch() 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
protected void | validateHandler(ObjectSE handler, HttpServletRequestEE request) 現在のリクエストに対して指定されたハンドラーを検証します。 |
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, hasCorsConfigurationSource, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setPatternParser, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatternsgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContextcloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEgetPatternParsergetHandler, usesPathPatternspublic void setRootHandler(@Nullable ObjectSE rootHandler)
デフォルトは null で、ルートハンドラーがないことを示します。
@Nullable public ObjectSE getRootHandler()
null がない場合は登録済み)。public void setUseTrailingSlashMatch(boolean useTrailingSlashMatch)
デフォルト値は false です。
public boolean useTrailingSlashMatch()
public void setLazyInitHandlers(boolean lazyInitHandlers)
コントローラーの遅延初期化を許可する場合は、コントローラーを "lazy-init" にして、このフラグを true に設定します。これらを "lazy-init" にするだけでは機能しません。この場合、ハンドラーマッピングからの参照を介して初期化されるためです。
@Nullable protected ObjectSE getHandlerInternal(HttpServletRequestEE request) throws ExceptionSE
AbstractHandlerMapping の getHandlerInternal request - 現在の HTTP リクエスト null ExceptionSE - 内部エラーがある場合 @Nullable protected ObjectSE lookupHandler(RequestPath path, StringSE lookupPath, HttpServletRequestEE request) throws ExceptionSE
PathPattern が enabled である場合に使用されます。path - 解析された RequestPathlookupPath - 直撃をチェックするための文字列 lookupPathrequest - 現在の HTTP リクエスト null ExceptionSE@Nullable protected ObjectSE lookupHandler(StringSE lookupPath, HttpServletRequestEE request) throws ExceptionSE
PathMatcher との文字列パターンマッチングが使用されている場合に使用されます。lookupPath - パターンを照合するパス request - 現在の HTTP リクエスト null ExceptionSEexposePathWithinMapping(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest), AntPathMatcherprotected void validateHandler(ObjectSE handler, HttpServletRequestEE request) throws ExceptionSE
デフォルトの実装は空です。たとえば、URL マッピングで表される特定の前提条件を強制するために、サブクラスでオーバーライドできます。
handler - 検証するハンドラーオブジェクト request - 現在の HTTP リクエスト ExceptionSE - 検証に失敗した場合 protected ObjectSE buildPathExposingHandler(ObjectSE rawHandler, StringSE bestMatchingPattern, StringSE pathWithinMapping, @Nullable MapSE<StringSE,StringSE> uriTemplateVariables)
HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE と HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE を公開して、指定された生のハンドラーのハンドラーオブジェクトを作成します。 デフォルトの実装では、パス属性と URI テンプレート変数を公開する特別なインターセプターを使用して HandlerExecutionChain を構築します
rawHandler - 公開する生のハンドラー pathWithinMapping - ハンドラーを実行する前に公開するパス uriTemplateVariables - URI テンプレート変数。変数が見つからない場合は null にできます protected void exposePathWithinMapping(StringSE bestMatchingPattern, StringSE pathWithinMapping, HttpServletRequestEE request)
pathWithinMapping - 現在のマッピング内のパス request - パスを公開するリクエスト HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTEprotected void exposeUriTemplateVariables(MapSE<StringSE,StringSE> uriTemplateVariables, HttpServletRequestEE request)
uriTemplateVariables - URI テンプレート変数 request - パスを公開するリクエスト HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE@Nullable public RequestMatchResult match(HttpServletRequestEE request, StringSE pattern)
MatchableHandlerMappingMatchableHandlerMapping.getPatternParser() が null を返す場合、このメソッドを使用します。これは、HandlerMapping が文字列パターンマッチングを使用していることを意味します。MatchableHandlerMapping 内の match request - 現在のリクエスト pattern - マッチングするパターン null protected void registerHandler(StringSE[] urlPaths, StringSE beanName) throws BeansException, IllegalStateExceptionSE
urlPaths - Bean がマッピングされる URLbeanName - ハンドラー Bean の名前 BeansException - ハンドラーを登録できなかった場合 IllegalStateExceptionSE - 競合するハンドラーが登録されている場合 protected void registerHandler(StringSE urlPath, ObjectSE handler) throws BeansException, IllegalStateExceptionSE
urlPath - Bean がマッピングされる URLhandler - ハンドラーインスタンスまたはハンドラー Bean name String (Bean 名は、対応するハンドラー Bean に自動的に解決されます)BeansException - ハンドラーを登録できなかった場合 IllegalStateExceptionSE - 競合するハンドラーが登録されている場合 public final MapSE<StringSE,ObjectSE> getHandlerMap()
public final MapSE<PathPattern,ObjectSE> getPathPatternHandlerMap()
getHandlerMap() と同じですが、解析されたパターンが enabled の場合に入力されます。それ以外の場合は空です。protected boolean supportsTypeLevelMappings()
false です。