Class WebResourceUtils
java.lang.Object
com.foreach.across.modules.web.resource.WebResourceUtils
Utilities for accessing the
WebResourceRegistry
and the WebAppPathResolver
when
running in a web context.- Since:
- 1.0.0
- Author:
- Arne Vandamme
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<WebAppLinkBuilder>
static Optional<org.springframework.context.MessageSource>
static WebAppPathResolver
static Optional<WebResourceRegistry>
static Optional<ViewElementBuilderContext>
static Optional<WebAppLinkBuilder>
getLinkBuilder
(jakarta.servlet.http.HttpServletRequest request) static Optional<WebAppLinkBuilder>
getLinkBuilder
(org.springframework.web.context.request.RequestAttributes request) static Optional<org.springframework.context.MessageSource>
getMessageSource
(jakarta.servlet.http.HttpServletRequest request) static Optional<org.springframework.context.MessageSource>
getMessageSource
(org.springframework.web.context.request.RequestAttributes request) static WebAppPathResolver
getPathResolver
(jakarta.servlet.http.HttpServletRequest request) static WebAppPathResolver
getPathResolver
(org.springframework.web.context.request.RequestAttributes request) static Optional<WebResourceRegistry>
getRegistry
(jakarta.servlet.http.HttpServletRequest request) static Optional<WebResourceRegistry>
getRegistry
(org.springframework.web.context.request.RequestAttributes request) static Optional<WebResourceRegistry>
getRegistry
(org.springframework.web.context.request.WebRequest request) static Optional<ViewElementBuilderContext>
getViewElementBuilderContext
(jakarta.servlet.http.HttpServletRequest request) static Optional<ViewElementBuilderContext>
getViewElementBuilderContext
(org.springframework.web.context.request.RequestAttributes request) static void
storeLinkBuilder
(WebAppLinkBuilder pathResolver, jakarta.servlet.http.HttpServletRequest request) static void
storeMessageSource
(org.springframework.context.MessageSource messageSource, jakarta.servlet.http.HttpServletRequest request) Store the primary message source on the request.static void
storePathResolver
(WebAppPathResolver pathResolver, jakarta.servlet.http.HttpServletRequest request) static void
storeRegistry
(WebResourceRegistry registry, jakarta.servlet.http.HttpServletRequest request) static void
storeViewElementBuilderContext
(ViewElementBuilderContext builderContext, jakarta.servlet.http.HttpServletRequest request)
-
Field Details
-
REGISTRY_ATTRIBUTE_KEY
Attribute key under which the registry is put in the request attributes- See Also:
-
PATH_RESOLVER_ATTRIBUTE_KEY
-
LINK_BUILDER_ATTRIBUTE_KEY
-
VIEW_ELEMENT_BUILDER_CONTEXT_KEY
-
MESSAGE_SOURCE_KEY
-
-
Constructor Details
-
WebResourceUtils
protected WebResourceUtils()
-
-
Method Details
-
storeRegistry
public static void storeRegistry(WebResourceRegistry registry, jakarta.servlet.http.HttpServletRequest request) -
currentRegistry
- Returns:
- the
WebResourceRegistry
for the request bound to the current thread
-
getRegistry
public static Optional<WebResourceRegistry> getRegistry(org.springframework.web.context.request.RequestAttributes request) -
getRegistry
public static Optional<WebResourceRegistry> getRegistry(org.springframework.web.context.request.WebRequest request) -
getRegistry
public static Optional<WebResourceRegistry> getRegistry(jakarta.servlet.http.HttpServletRequest request) -
storePathResolver
public static void storePathResolver(WebAppPathResolver pathResolver, jakarta.servlet.http.HttpServletRequest request) -
currentPathResolver
- Returns:
- the
WebAppPathResolver
for the request bound to the current thread
-
getPathResolver
public static WebAppPathResolver getPathResolver(org.springframework.web.context.request.RequestAttributes request) -
getPathResolver
-
storeLinkBuilder
public static void storeLinkBuilder(WebAppLinkBuilder pathResolver, jakarta.servlet.http.HttpServletRequest request) -
currentLinkBuilder
- Returns:
- the
WebAppLinkBuilder
for the request bound to the current thread
-
getLinkBuilder
public static Optional<WebAppLinkBuilder> getLinkBuilder(org.springframework.web.context.request.RequestAttributes request) -
getLinkBuilder
public static Optional<WebAppLinkBuilder> getLinkBuilder(jakarta.servlet.http.HttpServletRequest request) -
storeViewElementBuilderContext
public static void storeViewElementBuilderContext(ViewElementBuilderContext builderContext, jakarta.servlet.http.HttpServletRequest request) -
currentViewElementBuilderContext
- Returns:
- the
ViewElementBuilderContext
for the request bound to the current thread
-
getViewElementBuilderContext
public static Optional<ViewElementBuilderContext> getViewElementBuilderContext(org.springframework.web.context.request.RequestAttributes request) -
getViewElementBuilderContext
public static Optional<ViewElementBuilderContext> getViewElementBuilderContext(jakarta.servlet.http.HttpServletRequest request) -
storeMessageSource
public static void storeMessageSource(org.springframework.context.MessageSource messageSource, jakarta.servlet.http.HttpServletRequest request) Store the primary message source on the request. -
currentMessageSource
- Returns:
- primary message source attached to the request for the current thread
-
getMessageSource
public static Optional<org.springframework.context.MessageSource> getMessageSource(org.springframework.web.context.request.RequestAttributes request) -
getMessageSource
public static Optional<org.springframework.context.MessageSource> getMessageSource(jakarta.servlet.http.HttpServletRequest request)
-