Class ViewHistory

java.lang.Object
io.goobi.viewer.model.urlresolution.ViewHistory

public final class ViewHistory extends Object
Offers methods to store information about the current and previous html-view (page) in the session store.

The fullscreen view is explicitly excluded from the recorded views, since it acts only as a magnification of the image view, not as a separate page

Author:
Florian Alpers
  • Method Details

    • setCurrentView

      public static void setCurrentView(ServletRequest request)
      Saves the current view information to the session map. Also saves the previous view information to the session map if it represents a different view than the current view
      Parameters:
      request - a ServletRequest object.
    • setCurrentView

      public static void setCurrentView(ViewerPath currentPath, HttpSession session)
      Saves the given currentPath to the session map, keeping the previously stored currentPath as previousPath if it has a different PageType than the current path.

      The path stored as currentPath can be retrieved by getCurrentView(ServletRequest); the previously stored path can be retrieved by getPreviousView(ServletRequest)

      Parameters:
      currentPath - The path to store
      session - The http session to store the path in
    • getCurrentView

      public static Optional<ViewerPath> getCurrentView(ServletRequest request)
      Retrieves the stored currentPath from the session associated the the passed request.
      Parameters:
      request - a ServletRequest object.
      Returns:
      An optional containing the last stored current path if available. An empty optional if no session is available or no path has been stored yet
    • getPreviousView

      public static Optional<ViewerPath> getPreviousView(ServletRequest request)
      Retrieves the stored previousPath from the session associated the the passed request.
      Parameters:
      request - a ServletRequest object.
      Returns:
      An optional containing the last stored previous path if available. An empty optional if no session is available or no previous path has been stored yet
    • redirectToUrl

      public static void redirectToUrl(String url) throws IOException
      Directly redirect to the given url.
      Parameters:
      url - The url to redirect to
      Throws:
      IOException - if any.