public class ResourceUrlProvider extends ObjectSE implements ApplicationListener<ContextRefreshedEvent>
このクラスは、静的リソースを提供するために使用される Spring MVC ハンドラーマッピングを認識し、構成された ResourceHttpRequestHandler の ResourceResolver チェーンを使用して決定を行います。
| コンストラクターと説明 |
|---|
ResourceUrlProvider() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected void | detectResourceHandlers(ApplicationContext appContext) |
StringSE | getForLookupPath(StringSE lookupPath) 指定されたパスを構成済みのリソースハンドラーマッピングと比較し、一致が見つかった場合は、一致した ResourceHttpRequestHandler の ResourceResolver チェーンを使用して URL パスを解決し、公開用に公開します。 |
StringSE | getForRequestUrl(HttpServletRequestEE request, StringSE requestUrl) 完全なリクエスト URL パスを受け入れる getForLookupPath(String) のバリエーション(つまり |
MapSE<StringSE, ResourceHttpRequestHandler> | getHandlerMap()Spring ApplicationContext がリフレッシュされたときに手動で構成されたか、自動検出されたリソースマッピングを返します。 |
PathMatcher | getPathMatcher() 設定された PathMatcher を返します。 |
UrlPathHelper | getUrlPathHelper() 設定された UrlPathHelper を返します。 |
boolean | isAutodetect() リソースマッピングが手動で構成されている場合は false を返し、それ以外の場合は true を返します。 |
void | onApplicationEvent(ContextRefreshedEvent event) アプリケーションイベントを処理します。 |
void | setHandlerMap(MapSE<StringSE, ResourceHttpRequestHandler> handlerMap) リソースマッピングを手動で構成します。 |
void | setPathMatcher(PathMatcher pathMatcher) ターゲットルックアップパスをリソースマッピングと比較するときに使用する PathMatcher を構成します。 |
void | setUrlPathHelper(UrlPathHelper urlPathHelper) ターゲットリクエスト URL パスのルックアップパスを導出するために、 getForRequestUrl(javax.servlet.http.HttpServletRequest, String) で使用する UrlPathHelper を構成します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
getForRequestUrl(javax.servlet.http.HttpServletRequest, String) で使用する UrlPathHelper を構成します。public UrlPathHelper getUrlPathHelper()
UrlPathHelper を返します。public void setPathMatcher(PathMatcher pathMatcher)
PathMatcher を構成します。public PathMatcher getPathMatcher()
PathMatcher を返します。public void setHandlerMap(@Nullable MapSE<StringSE,ResourceHttpRequestHandler> handlerMap)
注意 : デフォルトでは、リソースマッピングは Spring ApplicationContext から自動検出されます。ただし、このプロパティを使用すると、自動検出はオフになります。
public MapSE<StringSE,ResourceHttpRequestHandler> getHandlerMap()
ApplicationContext がリフレッシュされたときに手動で構成されたか、自動検出されたリソースマッピングを返します。public boolean isAutodetect()
false を返し、それ以外の場合は true を返します。public void onApplicationEvent(ContextRefreshedEvent event)
ApplicationListenerApplicationListener<ContextRefreshedEvent> の onApplicationEvent event - 応答するイベント protected void detectResourceHandlers(ApplicationContext appContext)
@Nullable public final StringSE getForRequestUrl(HttpServletRequestEE request, StringSE requestUrl)
getForLookupPath(String) のバリエーション。request - 現在のリクエスト requestUrl - 解決するリクエスト URL パス null @Nullable public final StringSE getForLookupPath(StringSE lookupPath)
ResourceHttpRequestHandler の ResourceResolver チェーンを使用して URL パスを解決し、公開用に公開します。指定されたパスは、Spring MVC がリクエストマッピングの目的で使用するもの、つまり、コンテキストとサーブレットパスの部分を除くものであることが期待されます。
複数のハンドラーマッピングが一致する場合、使用されるハンドラーは、最も具体的なパターンで構成されたものになります。
lookupPath - チェックするルックアップパス null