Class ViewHistory
java.lang.Object
io.goobi.viewer.model.urlresolution.ViewHistory
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 Summary
Modifier and TypeMethodDescriptionstatic Optional<ViewerPath> getCurrentView(ServletRequest request) Retrieves the stored currentPath.static Optional<ViewerPath> getPreviousView(ServletRequest request) Retrieves the stored previousPath from the session associated the the passedrequest.static voidredirectToUrl(String url) Directly redirect to the given url.static voidsetCurrentView(ViewerPath currentPath, HttpServletRequest request) Saves the givencurrentPathas attribute of the given request and, if the request already has an http session, also to the session map (seesetCurrentView(ViewerPath, HttpSession)).static voidsetCurrentView(ViewerPath currentPath, HttpSession session) Saves the givencurrentPathto the session map, keeping the previously stored currentPath as previousPath if it has a different PageType than the current path.static voidsetCurrentView(ServletRequest request) Saves the current view information to the request and, if a session exists, to the session map.
-
Method Details
-
setCurrentView
Saves the current view information to the request and, if a session exists, to the session map. Also saves the previous view information to the session map if it represents a different view than the current view. Never creates a new http session.- Parameters:
request- aServletRequestobject.
-
setCurrentView
Saves the givencurrentPathas attribute of the given request and, if the request already has an http session, also to the session map (seesetCurrentView(ViewerPath, HttpSession)). Never creates a new http session. Storing the path in the request makes it available togetCurrentView(ServletRequest)for the rest of the request even if no session exists yet.- Parameters:
currentPath- The path to storerequest- The current request. If null, nothing is stored
-
setCurrentView
Saves the givencurrentPathto 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 bygetPreviousView(ServletRequest)- Parameters:
currentPath- The path to storesession- The http session to store the path in
-
getCurrentView
Retrieves the stored currentPath. The path stored in the passedrequestitself takes precedence; otherwise the path stored in the session associated with the request is returned.- Parameters:
request- aServletRequestobject.- Returns:
- An optional containing the last stored current path if available. An empty optional if neither the request nor its session contain a path
-
getPreviousView
Retrieves the stored previousPath from the session associated the the passedrequest.- Parameters:
request- aServletRequestobject.- 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
Directly redirect to the given url.- Parameters:
url- The url to redirect to- Throws:
IOException- if any.
-