Class ViewHistory

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

public final class ViewHistory extends Object
This class 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 seperate page
Author:
Florian Alpers
  • Method Details

    • setCurrentView

      public static void setCurrentView(javax.servlet.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, javax.servlet.http.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:
      session - The http session to store the path in
      currentPath - The path to store
    • getCurrentView

      public static Optional<ViewerPath> getCurrentView(javax.servlet.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(javax.servlet.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.