public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMapping implements MatchableHandlerMapping, EmbeddedValueResolverAware
logger
BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, 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() サフィックスパターンマッチングに使用するファイル拡張子を返します。 |
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 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) ContentNegotiationManager で明示的に登録されたパス拡張に対してのみ、サフィックスパターンマッチングが機能するかどうか。 |
void | setUseSuffixPatternMatch(boolean useSuffixPatternMatch) パターンをリクエストに一致させるときに、サフィックスパターン一致(".*" )を使用するかどうか。 |
void | setUseTrailingSlashMatch(boolean useTrailingSlashMatch) 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
boolean | useRegisteredSuffixPatternMatch() パターンマッチングに登録済みのサフィックスを使用するかどうか。 |
boolean | useSuffixPatternMatch() サフィックスパターンマッチングを使用するかどうか。 |
boolean | useTrailingSlashMatch() 末尾のスラッシュの有無に関係なく、URL に一致するかどうか。 |
getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, initHandlerMethods, lookupHandlerMethod, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurations, 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
public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch)
デフォルト値は true
です。
また、許可する特定のサフィックスのより詳細な制御については、setUseRegisteredSuffixPatternMatch(boolean)
を参照してください。
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()
public boolean useSuffixPatternMatch()
public boolean useRegisteredSuffixPatternMatch()
public boolean useTrailingSlashMatch()
@Nullable 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 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