public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMapping implements MatchableHandlerMapping, EmbeddedValueResolverAware
@Controller
クラスのタイプおよびメソッドレベルの @RequestMapping
アノテーションから RequestMappingInfo
インスタンスを作成します。非推奨のメモ:
5.2.4 では、useSuffixPatternMatch
および useRegisteredSuffixPatternMatch
は、リクエストのマッピングおよびコンテンツのネゴシエーション(ContentNegotiationManagerFactoryBean
での同様の非推奨)のためのパス拡張の使用を阻止するために非推奨です。詳細については、課題 #24719 を参照してください。logger
BEST_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_ATTRIBUTE
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
RequestMappingHandlerMapping() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterPropertiesSet() 初期化時にハンドラーメソッドを検出します。 |
protected RequestMappingInfo | createRequestMappingInfo(RequestMapping requestMapping, RequestCondition<?> customCondition) 提供された @RequestMapping アノテーションから RequestMappingInfo を作成します。これは、直接宣言されたアノテーション、メタアノテーション、またはアノテーション階層内のアノテーション属性をマージした合成結果のいずれかです。 |
ContentNegotiationManager | getContentNegotiationManager() 設定された ContentNegotiationManager を返します。 |
protected RequestCondition<?> | getCustomMethodCondition(MethodSE method) カスタムのメソッドレベルのリクエスト条件を指定します。 |
protected RequestCondition<?> | getCustomTypeCondition(ClassSE<?> handlerType) カスタム型レベルのリクエスト条件を指定します。 |
ListSE<StringSE> | getFileExtensions() 使用すべきではありません。 5.2.4 現在。パス拡張設定オプションの廃止に関するクラスレベルの注意を参照してください。 |
protected RequestMappingInfo | getMappingForMethod(MethodSE method, ClassSE<?> handlerType) メソッドおよび型レベルの @ RequestMapping アノテーションを使用して RequestMappingInfo を作成します。 |
MapSE<StringSE,PredicateSE<ClassSE<?>>> | getPathPrefixes() 構成されたパスは、読み取り専用の、おそらく空のマップとしてプレフィックスします。 |
protected CorsConfiguration | initCorsConfiguration(ObjectSE handler, MethodSE method, RequestMappingInfo mappingInfo) マッピングの CORS 設定を抽出して返します。 |
protected boolean | isHandler(ClassSE<?> beanType) 指定されたタイプがハンドラーメソッドを持つハンドラーかどうか。 |
RequestMatchResult | match(HttpServletRequestEE request, StringSE pattern) 指定されたリクエストがリクエスト条件に一致するかどうかを判断します。 |
protected void | registerHandlerMethod(ObjectSE handler, MethodSE method, RequestMappingInfo mapping) ハンドラーメソッドとその一意のマッピングを登録します。 |
void | registerMapping(RequestMappingInfo mapping, ObjectSE handler, MethodSE method) 指定されたマッピングを登録します。 |
protected StringSE[] | resolveEmbeddedValuesInPatterns(StringSE[] patterns) 指定されたパターンの配列のプレースホルダー値を解決します。 |
void | setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager) リクエストされたメディアタイプを判別するために使用する ContentNegotiationManager を設定します。 |
void | setEmbeddedValueResolver(StringValueResolver resolver) StringValueResolver を設定して、埋め込まれた定義値の解決に使用します。 |
void | setPathPrefixes(MapSE<StringSE,PredicateSE<ClassSE<?>>> prefixes) コントローラーメソッドに適用するパスプレフィックスを構成します。 |
void | setUseRegisteredSuffixPatternMatch(boolean useRegisteredSuffixPatternMatch) 使用すべきではありません。 5.2.4 現在。パス拡張設定オプションの廃止に関するクラスレベルのコメントを参照してください。 |
void | setUseSuffixPatternMatch(boolean useSuffixPatternMatch) 使用すべきではありません。 5.2.4 以降。パス拡張構成オプションの非推奨については、クラスレベルのコメントを参照してください。このメソッドに代わるものはないため、当面は false に設定する必要があります。5.3 では、false がデフォルトになると、このプロパティを使用する必要がなくなります。 |
void | setUseTrailingSlashMatch(boolean useTrailingSlashMatch) 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
boolean | useRegisteredSuffixPatternMatch() 使用すべきではありません。 5.2.4 現在。パス拡張設定オプションの廃止に関するクラスレベルの注意を参照してください。 |
boolean | useSuffixPatternMatch() 使用すべきではありません。 5.2.4 現在。パス拡張設定オプションの廃止に関するクラスレベルの注意を参照してください。 |
boolean | useTrailingSlashMatch() 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
getHandlerInternal, getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, initHandlerMethods, lookupHandlerMethod, processCandidateBean, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
getHandler
@DeprecatedSE public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch)
false
に設定する必要があります。5.3 で false
がデフォルトになると、このプロパティを使用する必要がなくなります デフォルト値は true
です。
また、許可する特定のサフィックスのより詳細な制御については、setUseRegisteredSuffixPatternMatch(boolean)
を参照してください。
@DeprecatedSE public void setUseRegisteredSuffixPatternMatch(boolean useRegisteredSuffixPatternMatch)
ContentNegotiationManager
で明示的に登録されたパス拡張に対してのみ、サフィックスパターンマッチングが機能するかどうか。これは一般に、あいまいさを減らし、「.」のような課題を回避するために推奨されます。他の理由でパスに表示されます。デフォルトでは、これは「false」に設定されています。
public void setUseTrailingSlashMatch(boolean useTrailingSlashMatch)
デフォルト値は true
です。
public void setPathPrefixes(MapSE<StringSE,PredicateSE<ClassSE<?>>> prefixes)
接頭辞は、コントローラータイプが対応する Predicate
と一致するすべての @RequestMapping
メソッドのマッピングを充実させるために使用されます。最初に一致する述語の接頭辞が使用されます。
HandlerTypePredicate
を使用してコントローラーをグループ化することを検討してください。
prefixes
- キーとしてパス接頭辞を持つマップ public MapSE<StringSE,PredicateSE<ClassSE<?>>> getPathPrefixes()
public void setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager)
ContentNegotiationManager
を設定します。設定されていない場合、デフォルトのコンストラクターが使用されます。public ContentNegotiationManager getContentNegotiationManager()
ContentNegotiationManager
を返します。public void setEmbeddedValueResolver(StringValueResolver resolver)
EmbeddedValueResolverAware
EmbeddedValueResolverAware
の setEmbeddedValueResolver
public void afterPropertiesSet()
AbstractHandlerMethodMapping
InitializingBean
の afterPropertiesSet
AbstractHandlerMethodMapping<RequestMappingInfo>
の afterPropertiesSet
AbstractHandlerMethodMapping.initHandlerMethods()
@DeprecatedSE public boolean useSuffixPatternMatch()
@DeprecatedSE public boolean useRegisteredSuffixPatternMatch()
public boolean useTrailingSlashMatch()
@Nullable @DeprecatedSE public ListSE<StringSE> getFileExtensions()
protected boolean isHandler(ClassSE<?> beanType)
ハンドラーには、型レベルの @Controller
アノテーションまたは型レベルの @RequestMapping
アノテーションのいずれかが必要です。
AbstractHandlerMethodMapping<RequestMappingInfo>
の isHandler
beanType
- チェックされている Bean のタイプ @Nullable protected RequestMappingInfo getMappingForMethod(MethodSE method, ClassSE<?> handlerType)
RequestMapping
アノテーションを使用して RequestMappingInfo を作成します。AbstractHandlerMethodMapping<RequestMappingInfo>
の getMappingForMethod
method
- マッピングを提供する方法 handlerType
- ハンドラー型、場合によってはメソッドの宣言クラスのサブタイプ @RequestMapping
アノテーションがない場合は null
getCustomMethodCondition(Method)
, getCustomTypeCondition(Class)
@Nullable protected RequestCondition<?> getCustomTypeCondition(ClassSE<?> handlerType)
RequestCondition
は、カスタムリクエスト条件を組み合わせて比較できるように、このメソッドへのすべての呼び出しから同じ条件タイプが返される限り、どのタイプでもかまいません。 カスタム条件タイプ用に AbstractRequestCondition
を継承し、CompositeRequestCondition
を使用して複数のカスタム条件を提供することを検討してください。
handlerType
- 条件を作成するハンドラータイプ null
@Nullable protected RequestCondition<?> getCustomMethodCondition(MethodSE method)
RequestCondition
は、カスタムリクエスト条件を組み合わせて比較できるように、このメソッドへのすべての呼び出しから同じ条件タイプが返される限り、どのタイプでもかまいません。 カスタム条件タイプ用に AbstractRequestCondition
を継承し、CompositeRequestCondition
を使用して複数のカスタム条件を提供することを検討してください。
method
- 条件を作成するハンドラーメソッド null
protected RequestMappingInfo createRequestMappingInfo(RequestMapping requestMapping, @Nullable RequestCondition<?> customCondition)
@RequestMapping
アノテーションから RequestMappingInfo
を作成します。これは、直接宣言されたアノテーション、メタアノテーション、またはアノテーション階層内のアノテーション属性をマージした合成結果のいずれかです。protected StringSE[] resolveEmbeddedValuesInPatterns(StringSE[] patterns)
public void registerMapping(RequestMappingInfo mapping, ObjectSE handler, MethodSE method)
AbstractHandlerMethodMapping
このメソッドは、初期化が完了した後、実行時に呼び出すことができます。
AbstractHandlerMethodMapping<RequestMappingInfo>
の registerMapping
mapping
- ハンドラーメソッドのマッピング handler
- ハンドラー method
- メソッド protected void registerHandlerMethod(ObjectSE handler, MethodSE method, RequestMappingInfo mapping)
AbstractHandlerMethodMapping
AbstractHandlerMethodMapping<RequestMappingInfo>
の registerHandlerMethod
handler
- ハンドラーまたはハンドラーインスタンスの Bean 名 method
- 登録する方法 mapping
- ハンドラーメソッドに関連付けられたマッピング条件 public RequestMatchResult match(HttpServletRequestEE request, StringSE pattern)
MatchableHandlerMapping
MatchableHandlerMapping
の match
request
- 現在のリクエスト pattern
- マッチングするパターン null
protected CorsConfiguration initCorsConfiguration(ObjectSE handler, MethodSE method, RequestMappingInfo mappingInfo)
AbstractHandlerMethodMapping
AbstractHandlerMethodMapping<RequestMappingInfo>
の initCorsConfiguration