Class UiRequestUtil

java.lang.Object
io.vertigo.ui.impl.springmvc.util.UiRequestUtil

public final class UiRequestUtil extends Object
Utility class for accessing and manipulating request associated attributes.
Author:
npiedeloup
  • Field Details

  • Method Details

    • invalidateHttpSession

      public static void invalidateHttpSession()
      Invalidates the current HTTP session, effectively logging out the user.
    • getCurrentViewContext

      public static ViewContext getCurrentViewContext()
      Retrieves the current ViewContext.
      Returns:
      the current ViewContext
    • obtainCurrentUiMessageStack

      public static io.vertigo.vega.webservice.validation.UiMessageStack obtainCurrentUiMessageStack()
      Obtains the current UiMessageStack.
      Returns:
      the current UiMessageStack
    • setCurrentUiMessageStack

      public static void setCurrentUiMessageStack(io.vertigo.vega.webservice.validation.UiMessageStack uiMessageStack)
      Sets the UiMessageStack for the current request.
      Parameters:
      uiMessageStack - the UiMessageStack to set
    • storeUiMessageStackInSession

      public static void storeUiMessageStackInSession()
      Stores the current UiMessageStack in the session. The stack is kept for max 3 minutes.
    • restoreUiMessageStackFromSession

      public static void restoreUiMessageStackFromSession()
      Restores the UiMessageStack from the session to the request and removes it from the session.
    • setRequestScopedAttribute

      public static void setRequestScopedAttribute(String name, Object value)
      Sets a request-scoped attribute.
      Parameters:
      name - the name of the attribute
      value - the value of the attribute
    • getRequestScopedAttribute

      public static <O> Optional<O> getRequestScopedAttribute(String name, Class<O> valueClass)
      Retrieves a request-scoped attribute as an Optional.
      Type Parameters:
      O - the type of the attribute
      Parameters:
      name - the name of the attribute
      valueClass - the class of the attribute
      Returns:
      an Optional containing the attribute value, or an empty Optional if not found
    • delayUiMessageStack

      public static void delayUiMessageStack()
      Persist the UiMessageStack until next request. Useful for example in the "close modale and refresh parent" pattern, to display messages from the popin in the parent.
    • isDelayUiMessageStack

      public static boolean isDelayUiMessageStack()
      Determines if delayUiMessageStack have been called in the current request.
      Returns:
      true if delayUiMessageStack have been called in the current request.
    • isJsonRequest

      public static boolean isJsonRequest(jakarta.servlet.http.HttpServletRequest request)
      Checks if the given HTTP request is a JSON request based on the "Accept" header.
      Parameters:
      request - the HTTP request
      Returns:
      true if the request is a JSON request, false otherwise