public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMapping implements MatchableHandlerMapping, EmbeddedValueResolverAware
@Controller
クラスの型およびメソッドレベルの @RequestMapping
アノテーションから RequestMappingInfo
インスタンスを作成します。非推奨のメモ:
5.2.4 では、リクエストマッピングおよびコンテンツネゴシエーションにパス拡張を使用しないようにするために、useSuffixPatternMatch
および useRegisteredSuffixPatternMatch
が非推奨になりました(ContentNegotiationManagerFactoryBean
でも同様の非推奨)。詳細については、#24719 号を参照してください。mappingsLogger
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 を作成します。これは、直接宣言されたアノテーション、メタアノテーション、アノテーション階層内のアノテーション属性をマージした合成結果のいずれかです。 |
RequestMappingInfo.BuilderConfiguration | getBuilderConfiguration() この HandlerMapping の内部構成を反映でき、RequestMappingInfo.Builder#options(RequestMappingInfo.BuilderConfiguration) の設定に使用できる RequestMappingInfo.BuilderConfiguration を入手します。 |
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 以降。パス拡張構成オプションの非推奨については、クラスレベルのメモを参照してください。このメソッドに代わるものはないため、5.2.x では false に設定する必要があります。5.3 では、デフォルトが false に変更され、このプロパティの使用は不要になります。 |
void | setUseTrailingSlashMatch(boolean useTrailingSlashMatch) 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
boolean | useRegisteredSuffixPatternMatch() 使用すべきではありません。 5.2.4 以降。 setUseRegisteredSuffixPatternMatch(boolean) の非推奨通知を参照してください。 |
boolean | useSuffixPatternMatch() 使用すべきではありません。 5.2.4 以降。 setUseSuffixPatternMatch(boolean) の非推奨通知を参照してください。 |
boolean | useTrailingSlashMatch() 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
getDirectPaths, getHandlerInternal, getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, initHandlerMethods, lookupHandlerMethod, processCandidateBean, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
getPatternParser
getHandler, usesPathPatterns
@DeprecatedSE public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch)
false
に設定する必要があります。5.3 では、デフォルトが false
に変更され、このプロパティの使用は不要になります デフォルト値では、これは false
に設定されています。
また、許可する特定のサフィックスのより詳細な制御については、setUseRegisteredSuffixPatternMatch(boolean)
を参照してください。
注意 : AbstractHandlerMethodMapping.setPatternParser(PathPatternParser)
が構成されている場合、このプロパティは無視されます。
@DeprecatedSE public void setUseRegisteredSuffixPatternMatch(boolean useRegisteredSuffixPatternMatch)
ContentNegotiationManager
で明示的に登録されたパス拡張に対してのみ、サフィックスパターンマッチングが機能するかどうか。これは一般に、あいまいさを減らし、"." のような課題を回避するために推奨されます。他の理由でパスに表示されます。デフォルトでは、これは "false" に設定されています。
注意 : AbstractHandlerMethodMapping.setPatternParser(PathPatternParser)
が構成されている場合、このプロパティは無視されます。
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()
setUseSuffixPatternMatch(boolean)
の非推奨通知を参照してください。@DeprecatedSE public boolean useRegisteredSuffixPatternMatch()
setUseRegisteredSuffixPatternMatch(boolean)
の非推奨通知を参照してください。public boolean useTrailingSlashMatch()
@Nullable @DeprecatedSE public ListSE<StringSE> getFileExtensions()
public RequestMappingInfo.BuilderConfiguration getBuilderConfiguration()
HandlerMapping
の内部構成を反映でき、RequestMappingInfo.Builder#options(RequestMappingInfo.BuilderConfiguration)
の設定に使用できる RequestMappingInfo.BuilderConfiguration
を入手します。 これは、registerHandlerMethod(Object, Method, RequestMappingInfo)
を介したリクエストマッピングのプログラムによる登録に役立ちます。
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)
注意 : RequestMappingInfo
を作成するには、getBuilderConfiguration()
を使用し、この HandlerMapping
の構成方法に一致するように RequestMappingInfo.Builder#options(RequestMappingInfo.BuilderConfiguration)
のオプションを設定してください。これは、たとえば PathPattern
または PathMatcher
ベースのマッチングを確実に使用するために重要です。
AbstractHandlerMethodMapping<RequestMappingInfo>
の registerHandlerMethod
handler
- ハンドラーまたはハンドラーインスタンスの Bean 名 method
- 登録する方法 mapping
- ハンドラーメソッドに関連付けられたマッピング条件 public RequestMatchResult match(HttpServletRequestEE request, StringSE pattern)
MatchableHandlerMapping
MatchableHandlerMapping.getPatternParser()
が null
を返す場合、このメソッドを使用します。これは、HandlerMapping
が文字列パターンマッチングを使用していることを意味します。MatchableHandlerMapping
の match
request
- 現在のリクエスト pattern
- マッチングするパターン null
protected CorsConfiguration initCorsConfiguration(ObjectSE handler, MethodSE method, RequestMappingInfo mappingInfo)
AbstractHandlerMethodMapping
AbstractHandlerMethodMapping<RequestMappingInfo>
の initCorsConfiguration