Class NavigationHelper

java.lang.Object
io.goobi.viewer.managedbeans.NavigationHelper
All Implemented Interfaces:
Serializable

@Named @SessionScoped public class NavigationHelper extends Object implements Serializable
JSF session-scoped backing bean providing navigation state, URL building, and breadcrumb tracking for the viewer frontend. Initialised via @PostConstruct init() which resolves the user's locale from the current JSF view root and seeds the status map with default values.

Lifecycle: Created once per HTTP session; survives across page navigations and is destroyed when the session expires.

Thread safety: Not explicitly synchronised; all state is expected to be accessed from the JSF request thread of the owning session only.

See Also:
  • Field Details

    • KEY_CURRENT_VIEW

      protected static final String KEY_CURRENT_VIEW
      Constant KEY_CURRENT_VIEW="currentView".
      See Also:
    • KEY_PREFERRED_VIEW

      protected static final String KEY_PREFERRED_VIEW
      Constant KEY_PREFERRED_VIEW="preferredView".
      See Also:
    • KEY_SELECTED_NEWS_ARTICLE

      protected static final String KEY_SELECTED_NEWS_ARTICLE
      Constant KEY_SELECTED_NEWS_ARTICLE="selectedNewsArticle".
      See Also:
    • KEY_MENU_PAGE

      protected static final String KEY_MENU_PAGE
      Constant KEY_MENU_PAGE="menuPage".
      See Also:
    • KEY_SUBTHEME_DISCRIMINATOR_VALUE

      protected static final String KEY_SUBTHEME_DISCRIMINATOR_VALUE
      Constant KEY_SUBTHEME_DISCRIMINATOR_VALUE="subThemeDicriminatorValue".
      See Also:
  • Constructor Details

    • NavigationHelper

      public NavigationHelper()
      Empty constructor.
    • NavigationHelper

      public NavigationHelper(String theme, FileResourceManager fileResourceManager)
  • Method Details

    • setCmsBean

      public void setCmsBean(CmsBean cmsBean)
    • setActiveDocumentBean

      public void setActiveDocumentBean(ActiveDocumentBean activeDocumentBean)
      Setter for testing — allows injecting a mock ActiveDocumentBean without CDI.
    • setBrowseBean

      public void setBrowseBean(BrowseBean browseBean)
      Setter for testing — allows injecting a mock BrowseBean without CDI.
    • setSearchBean

      public void setSearchBean(SearchBean searchBean)
      Setter for testing — allows injecting a mock SearchBean without CDI.
    • setCalendarBean

      public void setCalendarBean(CalendarBean calendarBean)
      Setter for testing — allows injecting a mock CalendarBean without CDI.
    • init

      @PostConstruct public void init()
      init.
    • setBreadcrumbBean

      public void setBreadcrumbBean(BreadcrumbBean breadcrumbBean)
      Required setter for ManagedProperty injection.
      Parameters:
      breadcrumbBean - breadcrumb bean to inject
    • searchPage

      public String searchPage()
      searchPage.
      Returns:
      the search page name after setting it as the current navigation page
    • homePage

      public String homePage()
      homePage.
      Returns:
      the home page name after setting it as the current navigation page
    • browsePage

      public String browsePage()
      browsePage.
      Returns:
      the browse page name after setting it as the current navigation page
    • getCurrentPage

      public String getCurrentPage()
      Getter for the field currentPage.
      Returns:
      the name of the currently active navigation page, with quotes escaped
    • isCmsPage

      public boolean isCmsPage()
      isCmsPage.
      Returns:
      true if the current page is a CMS page, false otherwise
    • setCmsPage

      public void setCmsPage(boolean isCmsPage)
      setCmsPage.
      Parameters:
      isCmsPage - true if the current page is a CMS page
    • getCMSPageNavigationId

      public static String getCMSPageNavigationId(CMSPage cmsPage)
      Produce an identifier string for a cms page to use for identifying the page in the navigation bar.
      Parameters:
      cmsPage - CMS page whose navigation identifier is to be determined
      Returns:
      String
    • setCurrentPage

      public void setCurrentPage(CMSPage cmsPage)
      Sets the CMS page as the current page for navigation purposes.

      Skips execution on JSF postback requests to avoid triggering during AJAX calls, which could conflict with parallel record loads. This mirrors the former <f:viewAction onPostback="false"> behavior that was declared in the view.

      Parameters:
      cmsPage - CMS page to set as current page
    • setCurrentPage

      public void setCurrentPage(String currentPage)
      Setter for the field currentPage.
      Parameters:
      currentPage - page name to set as current
    • setCurrentPageForError

      public void setCurrentPageForError(String errorType)
      Sets the current page for the error page, mapping generic error types (general, general_no_url) to the "error" page name so that the browser title shows "Fehler" instead of unrelated translations.

      Specific error types (e.g. recordNotFound, download) are passed through directly so that their own message keys are used as the page title.

      Parameters:
      errorType - the error type string set by the exception handler; may be null
    • setCurrentPage

      public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument)
      Setter for the field currentPage.
      Parameters:
      currentPage - page name to set as current
      resetBreadcrubs - if true, reset breadcrumbs
      resetCurrentDocument - if true, reset the loaded document
    • setCurrentPage

      public void setCurrentPage(String currentPage, boolean resetBreadcrubs, boolean resetCurrentDocument, boolean setCmsPage)
      Setter for the field currentPage.
      Parameters:
      currentPage - page name to set as current
      resetBreadcrubs - if true, reset breadcrumbs
      resetCurrentDocument - if true, reset the loaded document
      setCmsPage - if true, mark current page as CMS page
    • setCurrentBreadcrumbPage

      public void setCurrentBreadcrumbPage(String pageName, String pageWeight, String pageURL)
      setCurrentBreadcrumbPage.
      Parameters:
      pageName - display name for the breadcrumb entry
      pageWeight - breadcrumb sort weight as string
      pageURL - relative URL for the breadcrumb link
    • getPreferredView

      public String getPreferredView()
      Returns the manually selected view type (will be used for search result browsing, if set).
      Returns:
      the manually selected view type name, or null if none has been set
    • setPreferredView

      public void setPreferredView(String preferredView)
      Sets the manually selected view type (will be used for search result browsing, if set).
      Parameters:
      preferredView - view type name to set as preferred
    • setCurrentPageIndex

      public void setCurrentPageIndex()
      setCurrentPageIndex.
    • setCurrentPageSearch

      public void setCurrentPageSearch()
      setCurrentPageSearch.
    • setCurrentPageBrowse

      public void setCurrentPageBrowse()
      setCurrentPageBrowse.
    • setCurrentPageBrowse

      public void setCurrentPageBrowse(CollectionView collection)
      setCurrentPageBrowse.
      Parameters:
      collection - collection view to use for the breadcrumb link
    • setCurrentPageTags

      public void setCurrentPageTags()
      setCurrentPageTags.
    • setCurrentPageStatistics

      public void setCurrentPageStatistics()
      setCurrentPageStatistics.
    • setCrowdsourcingAnnotationPage

      public void setCrowdsourcingAnnotationPage(Campaign campaign, String pi, CrowdsourcingStatus status)
      Sets the current page to a crowdsourcing annotation page with the given campaign as parent and the given pi as current identifier.
      Parameters:
      campaign - crowdsourcing campaign to use as breadcrumb parent
      pi - persistent identifier of the record being annotated
      status - annotation or review status determining the URL action segment
    • setCurrentPageUser

      public void setCurrentPageUser()
      setCurrentPageUser.
    • setCurrentPageAdmin

      public void setCurrentPageAdmin(String pageName)
      setCurrentPageAdmin.
      Parameters:
      pageName - admin page name to activate
    • setCurrentPageAdmin

      public void setCurrentPageAdmin(String pageName, List<List<String>> labels)
    • createAdminBreadcrumbs

      protected List<LabeledLink> createAdminBreadcrumbs(PageType pageType, List<List<String>> labels)
      Parameters:
      pageType - page type for which the breadcrumb hierarchy is built
      labels - optional label overrides for each breadcrumb level
      Returns:
      List
    • setCurrentPageAdmin

      public void setCurrentPageAdmin()
      setCurrentPageAdmin.
    • setCurrentPageSitelinks

      public void setCurrentPageSitelinks()
      setCurrentPageSitelinks.
    • setCurrentPageTimeMatrix

      public void setCurrentPageTimeMatrix()
      setCurrentPageTimeMatrix.
    • setCurrentPageSearchTermList

      public void setCurrentPageSearchTermList()
      setCurrentPageSearchTermList.
    • resetCurrentPage

      public void resetCurrentPage()
      resetCurrentPage.
    • getViewAction

      public String getViewAction(String view)
      getViewAction.
      Parameters:
      view - view name to return as action string
      Returns:
      the given view name unchanged, for use as a JSF action outcome
    • getCurrentView

      public String getCurrentView()
      getCurrentView.
      Returns:
      the name of the currently selected content view
    • setCurrentView

      public void setCurrentView(String currentView)
      Sets the currently selected content view name.
      Parameters:
      currentView - view name to set as current
    • getDefaultLocale

      public Locale getDefaultLocale()
      getDefaultLocale.
      Returns:
      the default locale from the JSF application, or null if no FacesContext is available
    • getLocale

      public Locale getLocale()
      Getter for the field locale.
      Returns:
      the currently active locale
    • getLocaleString

      public String getLocaleString()
      Returns the language code of the current locale in the ISO 639-1 (two-character) format.
      Returns:
      the two-character ISO 639-1 language code of the current locale
    • getSupportedLocales

      public Iterator<Locale> getSupportedLocales()
      getSupportedLocales.
      Returns:
      an iterator over all supported application locales
    • getSupportedLanguages

      public List<String> getSupportedLanguages()
      Returns ISO 639-1 language codes of available JSF locales.
      Returns:
      a list of ISO 639-1 language codes for all supported application locales
    • getSupportedLanguagesAsJson

      public String getSupportedLanguagesAsJson()
      Returns ISO 639-1 language codes of available JSF locales as json array.
      Returns:
      a String to be interpreted as json array of strings.
    • setLocaleString

      public void setLocaleString(String inLocale)
      setLocaleString.
      Parameters:
      inLocale - ISO 639-1 language code to set as locale
    • getDatePattern

      public String getDatePattern()
      getDatePattern.
      Returns:
      the locale-appropriate date format pattern for the current locale
    • getDatePattern

      public static String getDatePattern(String language)
    • getDatePattern

      public static String getDatePattern(Locale locale)
    • getDatePatternjQueryDatePicker

      public String getDatePatternjQueryDatePicker()
      Get the date/time pattern for the current locale for use with jQuery date picker. Uses the value of getDatePattern() and adapts the month and year patterns in the following way:
      • MM --> mm
      • yyyy --> yy
      Returns:
      a date pattern suitable for jquery date picker
    • getDateTimePattern

      public String getDateTimePattern()
      Returns:
      Appropriate date/time pattern for the current locale
    • reload

      public void reload()
      reload.
    • getApplicationUrl

      public String getApplicationUrl()
      getApplicationUrl.
      Returns:
      the absolute base URL of the viewer application ending with a slash
    • getEncodedUrl

      public String getEncodedUrl()
      Used for social bookmarks.
      Returns:
      the current page URL encoded for use in social bookmark links
    • getCurrentUrl

      public String getCurrentUrl()
      getCurrentUrl.
      Returns:
      the absolute URL of the current request, or null if no request URL is available
    • getRssUrl

      public String getRssUrl()
      getRssUrl.
      Returns:
      the URL to the RSS feed for the current locale
    • getRequestPath

      public String getRequestPath(ExternalContext externalContext)
      getRequestPath.
      Parameters:
      externalContext - JSF external context providing the current request
      Returns:
      the complete Request Path, eg http://hostname.de/viewer/pathxyz/pathxyz/
    • getRequestPath

      public static String getRequestPath(HttpServletRequest request, String prettyFacesURI)
      getRequestPath.
      Parameters:
      request - incoming HTTP servlet request
      prettyFacesURI - PrettyFaces forwarded URI, may be null or empty
      Returns:
      the complete request URL including scheme, host, port and path
    • getFullRequestUrl

      public static String getFullRequestUrl(HttpServletRequest request, String prettyFacesURI)
      getFullRequestUrl.
      Parameters:
      request - incoming HTTP servlet request
      prettyFacesURI - PrettyFaces forwarded URI, may be null or empty
      Returns:
      the full request URL including query string for standard URLs, or the pretty URL without query string
    • getCurrentPrettyUrl

      public String getCurrentPrettyUrl()
      Returns the current PrettyURL.
      Returns:
      the current PrettyFaces URL of the active request
    • getTimeZone

      public TimeZone getTimeZone()
      getTimeZone.
      Returns:
      the default system time zone
    • setMenuPage

      public void setMenuPage(String page)
      setMenuPage.
      Parameters:
      page - menu page name to store in the status map
    • getMenuPage

      public String getMenuPage()
      getMenuPage.
      Returns:
      the currently active menu page name stored in the status map
    • getTheme

      public String getTheme()
      Getter for the field theme.
      Returns:
      the name of the currently active viewer theme
    • getSubThemeDiscriminatorValue

      public String getSubThemeDiscriminatorValue() throws IndexUnreachableException
      Returns the value of the configured sub-theme discriminator field. The value can be set via setSubThemeDiscriminatorValue(java.lang.String) (e.g. via PrettyFacces). If a record is currently loaded and has a dicriminatorField:discriminatorValue pair, the currently set value is replaced with that from the record.
      Returns:
      the current sub-theme discriminator value, or "-" if none is set
      Throws:
      IndexUnreachableException - if any.
    • determineCurrentSubThemeDiscriminatorValue

      public String determineCurrentSubThemeDiscriminatorValue()
      Get the subthemeDiscriminator value either from a property of the currently loaded CMS page or the currently loaded document in the activeDocumentbean if the current page is a docmentPage.
      Returns:
      the subtheme name determined from current cmsPage or current document. If Configuration.getSubthemeDiscriminatorField() is blank, always return an empty string
    • setSubThemeDiscriminatorValue

      public void setSubThemeDiscriminatorValue()
    • setSubThemeDiscriminatorValue

      public void setSubThemeDiscriminatorValue(String subThemeDiscriminatorValue)
      setSubThemeDiscriminatorValue.
      Parameters:
      subThemeDiscriminatorValue - discriminator value identifying the active sub-theme
    • resetTheme

      public void resetTheme()
      resetTheme.
    • getObjectUrl

      public String getObjectUrl()
      getObjectUrl.
      Returns:
      the absolute base URL for the object view page
    • getImageUrl

      public String getImageUrl()
      getImageUrl.
      Returns:
      the absolute base URL for the image view page
    • getCurrentPageTypeUrl

      public String getCurrentPageTypeUrl()
    • getImageActiveUrl

      public String getImageActiveUrl()
      getImageActiveUrl.
      Returns:
      the absolute base URL for the active image view page (with leading "!")
    • getCalendarUrl

      @Deprecated(since="26.03") public String getCalendarUrl()
      Deprecated.
      Calendar view has been retired; use getTocUrl()
      getCalendarUrl.
      Returns:
      the absolute base URL for the TOC (formerly calendar) view page
    • getCalendarActiveUrl

      @Deprecated(since="26.03") public String getCalendarActiveUrl()
      Deprecated.
      Calendar view has been retired; use getTocActiveUrl()
      getCalendarActiveUrl.
      Returns:
      the absolute active URL for the TOC (formerly calendar) view page (with leading "!")
    • getTocUrl

      public String getTocUrl()
      getTocUrl.
      Returns:
      the absolute base URL for the TOC view page
    • getTocActiveUrl

      public String getTocActiveUrl()
      getTocActiveUrl.
      Returns:
      the absolute active URL for the TOC view page (with leading "!")
    • getThumbsUrl

      public String getThumbsUrl()
      getThumbsUrl.
      Returns:
      the absolute base URL for the thumbnail view page
    • getThumbsActiveUrl

      public String getThumbsActiveUrl()
      getThumbsActiveUrl.
      Returns:
      the absolute active URL for the thumbnail view page (with leading "!")
    • getMetadataUrl

      public String getMetadataUrl()
      getMetadataUrl.
      Returns:
      the absolute base URL for the metadata view page
    • getMetadataActiveUrl

      public String getMetadataActiveUrl()
      getMetadataActiveUrl.
      Returns:
      the absolute active URL for the metadata view page (with leading "!")
    • getFulltextUrl

      public String getFulltextUrl()
      getFulltextUrl.
      Returns:
      the absolute base URL for the fulltext view page
    • getMeiActiveUrl

      public String getMeiActiveUrl()
      getMeiActiveUrl.
      Returns:
      the absolute active URL for the MEI music view page (with leading "!")
    • getMeiUrl

      public String getMeiUrl()
      getMeiUrl.
      Returns:
      the absolute base URL for the MEI music view page
    • getFulltextActiveUrl

      public String getFulltextActiveUrl()
      getFulltextActiveUrl.
      Returns:
      the absolute active URL for the fulltext view page (with leading "!")
    • getRecordUrl

      public String getRecordUrl(String pi, String docStructType, int order, boolean anchorOrGroup, boolean hasImages)
      Parameters:
      pi - persistent identifier of the record
      docStructType - structural type used to determine the page type
      order - page order within the record
      anchorOrGroup - true if the record is an anchor or group
      hasImages - true if the record has image pages
      Returns:
      Record URL
    • getSearchUrl

      public String getSearchUrl()
      getSearchUrl.
      Returns:
      the absolute URL for the regular search page
    • getAdvancedSearchUrl

      public String getAdvancedSearchUrl()
      getAdvancedSearchUrl.
      Returns:
      the absolute URL for the advanced search page
    • getPageUrl

      public String getPageUrl(String pageType)
      getPageUrl.
      Parameters:
      pageType - page type name to resolve to a URL
      Returns:
      the absolute URL for the given page type name, or empty string if the page type is unknown
    • getPageUrl

      public String getPageUrl(PageType page)
      getPageUrl.
      Parameters:
      page - page type whose absolute URL is returned
      Returns:
      the absolute URL for the given page type
    • getSearchUrl

      public String getSearchUrl(int activeSearchType)
      getSearchUrl.
      Parameters:
      activeSearchType - integer constant identifying the search type
      Returns:
      the absolute URL for the search page matching the given search type
    • getSearchUrl

      public String getSearchUrl(int activeSearchType, CMSPage cmsPage)
      getSearchUrl.
      Parameters:
      activeSearchType - integer constant identifying the search type
      cmsPage - optional CMS page with search functionality to redirect to instead
      Returns:
      the absolute URL for the search page matching the given type, or the CMS search page URL if provided
    • getTermUrl

      public String getTermUrl()
      getTermUrl.
      Returns:
      the absolute URL for the term browse search page
    • getBrowseUrl

      public String getBrowseUrl()
      getBrowseUrl.
      Returns:
      the absolute URL for the browse page
    • getSortUrl

      public String getSortUrl()
      getSortUrl.
      Returns:
      the absolute URL for the search page used as sort target
    • addStaticLinkToBreadcrumb

      public void addStaticLinkToBreadcrumb(String linkName, int linkWeight)
      Adds a link to the breadcrumbs using the current PrettyURL. Can be called from XHTML.
      Parameters:
      linkName - display label for the breadcrumb
      linkWeight - breadcrumb sort weight
    • addStaticLinkToBreadcrumb

      public void addStaticLinkToBreadcrumb(String linkName, String url, int linkWeight)
      Adds a link to the breadcrumbs using the given URL. Can be called from XHTML.
      Parameters:
      linkName - display label for the breadcrumb
      url - target URL for the breadcrumb link
      linkWeight - breadcrumb sort weight
    • getLocalDate

      public String getLocalDate(LocalDateTime date)
      Returns the string representation of the given Date based on the current locale.
      Parameters:
      date - date-time value to format
      Returns:
      the locale-formatted date string for the given date-time in the current locale
    • getMessageValueList

      public List<String> getMessageValueList(String keyPrefix)
      getMessageValueList.
      Parameters:
      keyPrefix - message key prefix to filter translations
      Returns:
      a list of message key strings matching the given prefix, sorted in reverse order
    • setSelectedNewsArticle

      public void setSelectedNewsArticle(String art)
      setSelectedNewsArticle.
      Parameters:
      art - identifier or key of the selected news article
    • getSelectedNewsArticle

      public String getSelectedNewsArticle()
      getSelectedNewsArticle.
      Returns:
      the identifier of the currently selected news article stored in the status map
    • getLastRequestTimestamp

      public String getLastRequestTimestamp()
      getLastRequestTimestamp.
      Returns:
      the timestamp string of the last request stored in the current HTTP session
    • getSessionIPAddress

      public String getSessionIPAddress()
    • getSessionId

      public Optional<String> getSessionId()
    • getStatusMapValue

      public String getStatusMapValue(String key)
      getStatusMapValue.
      Parameters:
      key - status map key to look up
      Returns:
      the value associated with the given key in the navigation status map
    • setStatusMapValue

      public void setStatusMapValue(String key, String value)
      setStatusMapValue.
      Parameters:
      key - status map key to set
      value - value to associate with the key
    • getStatusMap

      public Map<String,String> getStatusMap()
      Getter for the field statusMap.
      Returns:
      the navigation status map holding key-value pairs for the current navigation state
    • setStatusMap

      public void setStatusMap(Map<String,String> statusMap)
      Setter for the field statusMap.
      Parameters:
      statusMap - navigation status map to replace the current one
    • getTranslationWithParams

      public String getTranslationWithParams(String msgKey, String... params)
      Returns the translation for the given msgKey and replaces all {i} placeholders with values from the given params.
      Parameters:
      msgKey - Message key to translate
      params - One or more parameter values to replace the placeholders.
      Returns:
      Translated, escaped key with parameter replacements
    • getTranslationWithParamsUnescaped

      public String getTranslationWithParamsUnescaped(String msgKey, String... params)
      Returns the translation for the given msgKey and replaces all {i} placeholders with values from the given params.

      Does not carry out character escaping

      Parameters:
      msgKey - Message key to translate
      params - One or more parameter values to replace the placeholders.
      Returns:
      Translated, escaped key with parameter replacements
    • getTranslation

      public String getTranslation(String msgKey, String language)
      Returns a simple translation for the given language (or current language, if none given).
      Parameters:
      msgKey - Message key to translate
      language - Optional desired language
      Returns:
      Translated, escaped key
    • getTranslation

      public String getTranslation(String msgKey, String language, boolean escape)
      Returns a simple translation for the given language (or current language, if none given).
      Parameters:
      msgKey - Message key to translate
      language - Optional desired language
      escape - If true the return string will be Java-escaped
      Returns:
      Translated key
    • isDisplayNoIndexMetaTag

      public boolean isDisplayNoIndexMetaTag()
      Checks whether to display a noindex meta tag on the current page.
      Returns:
      true for a set of current page values; false otherwise
    • isDocumentPage

      public boolean isDocumentPage()
      Checks if the current page displays document information, solely based on the String getCurrentPage() The Pages for which this method should return true are set in the PageType class.
      Returns:
      true if the current page is a document display page (as defined in PageType), false otherwise
    • getSubThemeDiscriminatorQuerySuffix

      public String getSubThemeDiscriminatorQuerySuffix() throws IndexUnreachableException
      getSubThemeDiscriminatorQuerySuffix.
      Returns:
      the Solr query suffix for filtering by the current sub-theme discriminator value
      Throws:
      IndexUnreachableException - if any.
    • getCurrentPageType

      public PageType getCurrentPageType()
      Get the PageType for the page name from getCurrentPage().
      Returns:
      the PageType corresponding to the current page name
    • getPreviousViewUrl

      public String getPreviousViewUrl()
      getPreviousViewUrl.
      Returns:
      the URL of the previously visited view, or "/" if no previous view is available
    • redirectToPreviousView

      public void redirectToPreviousView() throws IOException
      redirectToPreviousView.
      Throws:
      IOException - if any.
    • getCurrentViewUrl

      public String getCurrentViewUrl()
      getCurrentViewUrl.
      Returns:
      the URL of the currently active view, or "/" if no current view is available
    • getCurrentViewPrettyUrl

      public String getCurrentViewPrettyUrl()
    • getExitUrl

      public String getExitUrl()
    • getExitUrl

      public String getExitUrl(PageType pageType)
      Parameters:
      pageType - current page type used to look up the configured exit view
      Returns:
      Appropriate exit URL
    • resolvePrettyUrl

      public String resolvePrettyUrl(String prettyId, Object... parameters)
      Parameters:
      prettyId - PrettyFaces mapping ID to resolve
      parameters - optional parameter values to fill into the URL pattern
      Returns:
      Resolved Pretty URL
    • redirectToCurrentView

      public void redirectToCurrentView() throws IOException
      redirectToCurrentView.
      Throws:
      IOException - if any.
    • urlEncode

      public String urlEncode(String s)
      urlEncode.
      Parameters:
      s - string to URL-encode
      Returns:
      the URL-encoded representation of the input string
    • urlEncodeUnicode

      public String urlEncodeUnicode(String s)
      urlEncodeUnicode.
      Parameters:
      s - string to encode with Unicode-safe escaping
      Returns:
      the input string with critical URL characters Unicode-safely escaped
    • getThemeOrSubtheme

      public String getThemeOrSubtheme()
      getThemeOrSubtheme.
      Returns:
      the active sub-theme discriminator value if set, otherwise the default theme name
    • isSubthemeSelected

      public boolean isSubthemeSelected() throws IndexUnreachableException
      isSubthemeSelected.
      Returns:
      true exactly if getSubThemeDiscriminatorValue() is not blank
      Throws:
      IndexUnreachableException - if any.
    • getVersion

      public String getVersion()
      getVersion.
      Returns:
      the version string of the viewer application
    • getBuildDate

      public String getBuildDate()
      getBuildDate.
      Returns:
      the build date string of the viewer application
    • getBuildVersion

      public String getBuildVersion()
      getBuildVersion.
      Returns:
      the build version string of the viewer application
    • getApplicationName

      public String getApplicationName()
      getApplicationName.
      Returns:
      the display name of the viewer application
    • getResource

      public String getResource(String path)
      Get the path to a viewer resource relative to the root path ("/viewer") If it exists, the resource from the theme, otherwise from the core If the resource exists neither in theme nor core. An Exception will be thrown
      Parameters:
      path - The resource path relative to the first "resources" directory
      Returns:
      Resource path
    • getResource

      public String getResource(String path, boolean considerAlternativeSuffixes)
      Get the path to a viewer resource relative to the root path ("/viewer") If it exists, the resource from the theme, otherwise from the core If the resource exists neither in theme nor core. An Exception will be thrown
      Parameters:
      path - The resource path relative to the first "resources" directory
      considerAlternativeSuffixes - Whether to check files with different file extensions in the theme if the given file doesn't exist there. This does not effect the core path.
      Returns:
      Resource path
    • getResource

      public String getResource(String path, List<String> alternativeSuffixes)
      Get the path to a viewer resource relative to the root path ("/viewer") If it exists, the resource from the theme, otherwise from the core If the resource exists neither in theme nor core. An Exception will be thrown
      Parameters:
      path - The resource path relative to the first "resources" directory
      alternativeSuffixes - a list of alternative file extensions to check in the theme if the given file doesn't exist there. This does not effect the core path. May be an empty list, but not null. Suffixes should be written without the extension separator dot
      Returns:
      Resource path
    • getLicenceIconResources

      public List<String> getLicenceIconResources(List<String> icons)
      Resolves a list of licence icon names to their resource URIs, filtering out any icons whose resolved path is blank or a directory (trailing slash). This method is intended for use in Facelets templates that pass the result directly to <ui:include>, where an invalid path would cause a TagAttributeException at view-build time.
      Parameters:
      icons - list of icon file names (e.g. "cc0.svg"); blank entries are ignored
      Returns:
      ordered list of resolved resource URIs suitable for use as <ui:include src="..."> values
    • isRtl

      public boolean isRtl()
    • isRtl

      public boolean isRtl(String lang)
    • isRtl

      public boolean isRtl(Locale locale)
    • isSolrIndexOnline

      public boolean isSolrIndexOnline()
    • addSearchUrlWithCurrentSortStringToHistory

      public void addSearchUrlWithCurrentSortStringToHistory()
      If the current page url is a search page url without or with empty search parameters replace ViewHistory.getCurrentView(jakarta.servlet.ServletRequest) with a search url containing the default sort string. This is done so the view history contains the current random seed for random search list sorting and returning to the page yields the same ordering as the original call. Must be called in the pretty mappings for all search urls which deliver randomly sorted hitlists
    • getCurrentTime

      public String getCurrentTime()
      Gets the current time in milliseconds as string.
      Returns:
      the current time in milliseconds as string
    • getCurrentDate

      public LocalDate getCurrentDate()
      Get the current date as LocalDate.
      Returns:
      the current date as LocalDate
    • getTranslationsAsJson

      public String getTranslationsAsJson(List<String> keys)
      Parameters:
      keys - list of message keys to translate
      Returns:
      JSON with translations for the given message keys
    • getRange

      public List<Integer> getRange(long from, long to)
    • getAsId

      public String getAsId(String text)