Class ViewerPath

java.lang.Object
io.goobi.viewer.model.urlresolution.ViewerPath
All Implemented Interfaces:
Serializable

public class ViewerPath extends Object implements Serializable
Stores the url path of a http request organized by its logical parts so application url, application name, view type and parameter urls can be retrieved independendly. If applicable, the PageType of the requested view and an associated CMSPage are also referenced

This information helps calling the correct url in different contexts and is also used to redirect to CMSPages and store a brief view history to allow returning to a previous view The entire url always consists of the properties applicationUrl + pagePath + parameterPath

The easiest way to create ViewerPath based on a http request is by calling ViewerPathBuilder.createPath(HttpServletRequest) or io.goobi.viewer.model.urlresolution.ViewerPathBuilder#createPath(String, String, String)

Author:
Florian Alpers
See Also:
  • Constructor Details

    • ViewerPath

      public ViewerPath()
      Creates an empty ViewerPath. Usually this does not need to be called directly. Instead a ViewerPath should be created by calling ViewerPathBuilder.createPath(HttpServletRequest) or io.goobi.viewer.model.urlresolution.ViewerPathBuilder#createPath(String, String, String)
    • ViewerPath

      public ViewerPath(ViewerPath blueprint)
      Creates an exact copy of the passed blueprint. This only creates a shallow copy, which is irrelevant to almost all properties which are immutables, cmsPage being the only exception (but that is ok since all paths should indeed point to the same CMSPage)
      Parameters:
      blueprint - The ViewerPath to be copied
  • Method Details

    • getApplicationUrl

      public String getApplicationUrl()

      Getter for the field applicationUrl.

      Returns:
      the applicationUrl
    • setApplicationUrl

      public void setApplicationUrl(String applicationUrl)

      Setter for the field applicationUrl.

      Parameters:
      applicationUrl - The applicationUrl to set
    • getPagePath

      public URI getPagePath()

      Getter for the field pagePath.

      Returns:
      the pagePath
    • setPagePath

      public void setPagePath(URI pagePath)

      Setter for the field pagePath.

      Parameters:
      pagePath - the pagePath to set
    • getParameterPath

      public URI getParameterPath()

      Getter for the field parameterPath.

      Returns:
      the parameterPath
    • setParameterPath

      public void setParameterPath(URI parameterPath)

      Setter for the field parameterPath.

      Parameters:
      parameterPath - the parameterPath to set
    • getQueryString

      public String getQueryString()
      Returns:
      the queryString
    • setQueryString

      public void setQueryString(String queryString)
      Parameters:
      queryString - the queryString to set
    • getPrettifiedPagePath

      public URI getPrettifiedPagePath()

      getPrettifiedPagePath.

      Returns:
      The alternative url or static page url of a CMSPage if present, otherwise pagePath
    • getCombinedPrettyfiedPath

      public URI getCombinedPrettyfiedPath()

      getCombinedPrettyfiedPath.

      Returns:
      the entire prettified url except the application url
    • getCombinedPrettyfiedUrl

      public String getCombinedPrettyfiedUrl()

      getCombinedPrettyfiedUrl.

      Returns:
      the entire prettified url as a path except the application url
    • getCombinedPath

      public URI getCombinedPath()

      getCombinedPath.

      Returns:
      the entire request url as a path except the application url
    • getCombinedUrl

      public String getCombinedUrl()

      getCombinedUrl.

      Returns:
      the entire request url except the application url
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isPage

      public boolean isPage()

      isPage.

      Returns:
      true if this path has been associated with a pageType other than 'other'
    • setPageType

      public void setPageType(PageType pageType)

      Setter for the field pageType.

      Parameters:
      pageType - the PageType to set
    • getPageType

      public PageType getPageType()

      Getter for the field pageType.

      Returns:
      the pageType
    • matches

      public boolean matches(PageType pageType)

      matches.

      Parameters:
      pageType - a PageType object.
      Returns:
      The matching PageType or null if no PageType matches
      See Also:
      • PageType#matches(Path)
    • getCmsPage

      public CMSPage getCmsPage()

      Getter for the field cmsPage.

      Returns:
      the cmsPage if one is associated with this path. Otherwise null
    • setCmsPage

      public void setCmsPage(CMSPage cmsPage)

      Setter for the field cmsPage.

      Parameters:
      cmsPage - the cmsPage to set
    • getCampaign

      public Campaign getCampaign()

      Getter for the field campaign.

      Returns:
      the campaign
    • setCampaign

      public void setCampaign(Campaign campaign)

      Setter for the field campaign.

      Parameters:
      campaign - the campaign to set
    • getApplicationName

      public String getApplicationName()

      Getter for the field applicationName.

      Returns:
      the applicationName
    • setApplicationName

      public void setApplicationName(String applicationName)

      Setter for the field applicationName.

      Parameters:
      applicationName - the applicationName to set
    • isCmsPage

      public boolean isCmsPage()

      isCmsPage.

      Returns:
      a boolean.