Package org.codelibs.fess.helper
Class PathMappingHelper
java.lang.Object
org.codelibs.fess.helper.AbstractConfigHelper
org.codelibs.fess.helper.PathMappingHelper
Helper class for path mapping configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<org.codelibs.fess.opensearch.config.exentity.PathMapping> Cached list of path mappings.protected static final StringFunction matcher for encode URL.protected static final StringGroovy matcher prefix.Map of path mappings by process type.Fields inherited from class org.codelibs.fess.helper.AbstractConfigHelper
reloadInterval -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreatePathMatcher(Matcher matcher, String replacement) Creates a path matcher function for path mapping.List<org.codelibs.fess.opensearch.config.exentity.PathMapping> getPathMappingList(String sessionId) Gets the path mapping list for a session.Gets the list of process types.voidinit()Initializes the path mapping helper.intload()Load the configuration.protected booleanmatchUserAgent(org.codelibs.fess.opensearch.config.exentity.PathMapping pathMapping) Checks if the user agent matches the path mapping.voidremovePathMappingList(String sessionId) Removes the path mapping list for a session.replaceUrl(String url) Replaces URL for display or URL converter.replaceUrl(String sessionId, String url) Replaces URL for crawling.protected StringreplaceUrl(List<org.codelibs.fess.opensearch.config.exentity.PathMapping> pathMappingList, String url) Replaces URL using the given path mapping list.replaceUrls(String text) Replaces URLs in text.voidsetPathMappingList(String sessionId, List<org.codelibs.fess.opensearch.config.exentity.PathMapping> pathMappingList) Sets the path mapping list for a session.Methods inherited from class org.codelibs.fess.helper.AbstractConfigHelper
setReloadInterval, update, waitForNext
-
Field Details
-
FUNCTION_ENCODEURL_MATCHER
Function matcher for encode URL.- See Also:
-
GROOVY_MATCHER
Groovy matcher prefix.- See Also:
-
pathMappingMap
protected final Map<String,List<org.codelibs.fess.opensearch.config.exentity.PathMapping>> pathMappingMapMap of path mappings by process type. -
cachedPathMappingList
protected volatile List<org.codelibs.fess.opensearch.config.exentity.PathMapping> cachedPathMappingListCached 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:AbstractConfigHelperLoad the configuration.- Specified by:
loadin classAbstractConfigHelper- Returns:
- The number of loaded configurations.
-
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 IDpathMappingList- the path mapping list
-
removePathMappingList
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
Replaces URL for crawling.- Parameters:
sessionId- the session IDurl- the URL to replace- Returns:
- the replaced URL
-
replaceUrls
Replaces URLs in text.- Parameters:
text- the text containing URLs- Returns:
- the text with replaced URLs
-
replaceUrl
Replaces URL for display or URL converter.- Parameters:
url- the URL to replace- Returns:
- the replaced URL
-
createPathMatcher
Creates a path matcher function for path mapping.- Parameters:
matcher- the regex matcherreplacement- 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 listurl- 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
-