public class ResourceHandlerRegistry extends ObjectSE
リソースハンドラーを作成するには、addResourceHandler(String...) を使用して、静的リソースを提供するためにハンドラーを呼び出す必要がある URL パスパターンを提供します(例: "/resources/**")。
次に、返された ResourceHandlerRegistration で追加のメソッドを使用して、静的コンテンツの提供元となる 1 つ以上の場所(例: {"/"、"classpath:/META-INF/public-web-resources/"})を追加するか、提供されるリソースのキャッシュ期間を指定します。
DefaultServletHandlerConfigurer| コンストラクターと説明 |
|---|
ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext) 指定されたアプリケーションコンテキストの新しいリソースハンドラーレジストリを作成します。 |
ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext, ContentNegotiationManager contentNegotiationManager) 指定されたアプリケーションコンテキストの新しいリソースハンドラーレジストリを作成します。 |
ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext, ContentNegotiationManager contentNegotiationManager, UrlPathHelper pathHelper) 静的リソースへのリクエストのマッピングに使用される UrlPathHelper も受け入れる ResourceHandlerRegistry(ApplicationContext, ServletContext, ContentNegotiationManager) のバリアント。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
ResourceHandlerRegistration | addResourceHandler(StringSE... pathPatterns) 指定された URL パスパターンに基づいて静的リソースを提供するリソースハンドラーを追加します。 |
protected AbstractHandlerMapping | getHandlerMapping() マップされたリソースハンドラーでハンドラーマッピングを返します。登録がない場合は null。 |
boolean | hasMappingForPattern(StringSE pathPattern) リソースハンドラーが指定されたパスパターンにすでに登録されているかどうか。 |
ResourceHandlerRegistry | setOrder(int order)Spring MVC アプリケーションコンテキストで構成された他の HandlerMappings に関連するリソース処理に使用する順序を指定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext)
applicationContext - Spring アプリケーションコンテキスト servletContext - 対応するサーブレットコンテキスト public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext, @Nullable ContentNegotiationManager contentNegotiationManager)
applicationContext - Spring アプリケーションコンテキスト servletContext - 対応するサーブレットコンテキスト contentNegotiationManager - 使用するコンテンツ交渉マネージャー public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContextEE servletContext, @Nullable ContentNegotiationManager contentNegotiationManager, @Nullable UrlPathHelper pathHelper)
UrlPathHelper も受け入れる ResourceHandlerRegistry(ApplicationContext, ServletContext, ContentNegotiationManager) のバリアント。public ResourceHandlerRegistration addResourceHandler(StringSE... pathPatterns)
"/static/**" または "/css/{filename:\\w+\\.css}" のようなパターンが許可されます。構文の詳細については、AntPathMatcher を参照してください。
ResourceHandlerRegistrationpublic boolean hasMappingForPattern(StringSE pathPattern)
public ResourceHandlerRegistry setOrder(int order)
HandlerMappings に関連するリソース処理に使用する順序を指定します。 使用されるデフォルト値は Integer.MAX_VALUE-1 です。
@Nullable protected AbstractHandlerMapping getHandlerMapping()
null。