Class PathMappingHelper

java.lang.Object
org.codelibs.fess.helper.AbstractConfigHelper
org.codelibs.fess.helper.PathMappingHelper

public class PathMappingHelper extends AbstractConfigHelper
Helper class for path mapping configuration.
  • Field Details

    • FUNCTION_ENCODEURL_MATCHER

      protected static final String FUNCTION_ENCODEURL_MATCHER
      Function matcher for encode URL.
      See Also:
    • GROOVY_MATCHER

      protected static final String GROOVY_MATCHER
      Groovy matcher prefix.
      See Also:
    • pathMappingMap

      protected final Map<String,List<org.codelibs.fess.opensearch.config.exentity.PathMapping>> pathMappingMap
      Map of path mappings by process type.
    • cachedPathMappingList

      protected volatile List<org.codelibs.fess.opensearch.config.exentity.PathMapping> cachedPathMappingList
      Cached list of path mappings.
  • Constructor Details

    • PathMappingHelper

      public PathMappingHelper()
      Default constructor.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the path mapping helper.
    • load

      public int load()
      Description copied from class: AbstractConfigHelper
      Load the configuration.
      Specified by:
      load in class AbstractConfigHelper
      Returns:
      The number of loaded configurations.
    • getProcessTypeList

      protected List<String> getProcessTypeList()
      Gets the list of process types.
      Returns:
      the list of process types
    • setPathMappingList

      public void setPathMappingList(String sessionId, List<org.codelibs.fess.opensearch.config.exentity.PathMapping> pathMappingList)
      Sets the path mapping list for a session.
      Parameters:
      sessionId - the session ID
      pathMappingList - the path mapping list
    • removePathMappingList

      public void removePathMappingList(String sessionId)
      Removes the path mapping list for a session.
      Parameters:
      sessionId - the session ID
    • getPathMappingList

      public List<org.codelibs.fess.opensearch.config.exentity.PathMapping> getPathMappingList(String sessionId)
      Gets the path mapping list for a session.
      Parameters:
      sessionId - the session ID
      Returns:
      the path mapping list
    • replaceUrl

      public String replaceUrl(String sessionId, String url)
      Replaces URL for crawling.
      Parameters:
      sessionId - the session ID
      url - the URL to replace
      Returns:
      the replaced URL
    • replaceUrls

      public String replaceUrls(String text)
      Replaces URLs in text.
      Parameters:
      text - the text containing URLs
      Returns:
      the text with replaced URLs
    • replaceUrl

      public String replaceUrl(String url)
      Replaces URL for display or URL converter.
      Parameters:
      url - the URL to replace
      Returns:
      the replaced URL
    • createPathMatcher

      public BiFunction<String,Matcher,String> createPathMatcher(Matcher matcher, String replacement)
      Creates a path matcher function for path mapping.
      Parameters:
      matcher - the regex matcher
      replacement - the replacement string
      Returns:
      the path matcher function
    • replaceUrl

      protected String replaceUrl(List<org.codelibs.fess.opensearch.config.exentity.PathMapping> pathMappingList, String url)
      Replaces URL using the given path mapping list.
      Parameters:
      pathMappingList - the path mapping list
      url - the URL to replace
      Returns:
      the replaced URL
    • matchUserAgent

      protected boolean matchUserAgent(org.codelibs.fess.opensearch.config.exentity.PathMapping pathMapping)
      Checks if the user agent matches the path mapping.
      Parameters:
      pathMapping - the path mapping
      Returns:
      true if the user agent matches