public class ResourceUrlProvider extends ObjectSE implements ApplicationListener<ContextRefreshedEvent>, ApplicationContextAware
このクラスは、静的リソースを提供するために使用される Spring WebFlux ハンドラーマッピングを認識し、構成された ResourceHttpRequestHandler
の ResourceResolver
チェーンを使用して決定を行います。
コンストラクターと説明 |
---|
ResourceUrlProvider() |
修飾子と型 | メソッドと説明 |
---|---|
reactor.core.publisher.Mono<StringSE> | getForUriString(StringSE uriString, ServerWebExchange exchange) 指定された URI 文字列のパブリックリソース URL を取得します。 |
MapSE<PathPattern, ResourceWebHandler> | getHandlerMap() 手動で構成されたか、Spring 構成から自動検出されたリソースハンドラーマッピングの読み取り専用ビューを返します。 |
void | onApplicationEvent(ContextRefreshedEvent event) アプリケーションイベントを処理します。 |
void | registerHandlers(MapSE<StringSE, ResourceWebHandler> handlerMap) リソースハンドラーマッピングを手動で構成します。 |
void | setApplicationContext(ApplicationContext applicationContext) このオブジェクトが実行される ApplicationContext を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
forPayload
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
ApplicationContextAware
通常の Bean プロパティの設定後、ただし InitializingBean.afterPropertiesSet()
またはカスタム init メソッドなどの init コールバックの前に呼び出されます。ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
、ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
および MessageSourceAware
の後に呼び出されます(該当する場合)。
ApplicationContextAware
の setApplicationContext
applicationContext
- このオブジェクトによって使用される ApplicationContext オブジェクト ApplicationContextException
- コンテキスト初期化エラーの場合 BeansException
- アプリケーションコンテキストメソッドによってスローされた場合 BeanInitializationException
public MapSE<PathPattern,ResourceWebHandler> getHandlerMap()
public void registerHandlers(MapSE<StringSE,ResourceWebHandler> handlerMap)
注意 : デフォルトでは、リソースマッピングは Spring ApplicationContext
から自動検出されます。このプロパティを使用すると、自動検出がオフになります。
public void onApplicationEvent(ContextRefreshedEvent event)
ApplicationListener
ApplicationListener<ContextRefreshedEvent>
の onApplicationEvent
event
- 応答するイベント public final reactor.core.publisher.Mono<StringSE> getForUriString(StringSE uriString, ServerWebExchange exchange)
URI 文字列はパスであることが想定されており、クエリまたはフラグメントが含まれている場合、結果のパブリックリソース URL に保持されます。
uriString
- 変換する URI 文字列 exchange
- 現在の交換