Class WebResourceUtils

java.lang.Object
com.foreach.across.modules.web.resource.WebResourceUtils

public class WebResourceUtils extends Object
Utilities for accessing the WebResourceRegistry and the WebAppPathResolver when running in a web context.
Since:
1.0.0
Author:
Arne Vandamme
  • Field Details

    • REGISTRY_ATTRIBUTE_KEY

      public static final String REGISTRY_ATTRIBUTE_KEY
      Attribute key under which the registry is put in the request attributes
      See Also:
    • PATH_RESOLVER_ATTRIBUTE_KEY

      public static final String PATH_RESOLVER_ATTRIBUTE_KEY
    • VIEW_ELEMENT_BUILDER_CONTEXT_KEY

      public static final String VIEW_ELEMENT_BUILDER_CONTEXT_KEY
    • MESSAGE_SOURCE_KEY

      public static final String MESSAGE_SOURCE_KEY
  • Constructor Details

    • WebResourceUtils

      protected WebResourceUtils()
  • Method Details

    • storeRegistry

      public static void storeRegistry(WebResourceRegistry registry, jakarta.servlet.http.HttpServletRequest request)
    • currentRegistry

      public static Optional<WebResourceRegistry> 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

      public static WebAppPathResolver 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

      public static WebAppPathResolver getPathResolver(jakarta.servlet.http.HttpServletRequest request)
    • storeLinkBuilder

      public static void storeLinkBuilder(WebAppLinkBuilder pathResolver, jakarta.servlet.http.HttpServletRequest request)
    • currentLinkBuilder

      public static Optional<WebAppLinkBuilder> 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

      public static Optional<ViewElementBuilderContext> 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

      public static Optional<org.springframework.context.MessageSource> 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)