add PathHelper

This commit is contained in:
Shinsuke Sugaya 2018-05-01 20:59:25 +09:00
parent f11169716a
commit ae68e2175b
2 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ import java.util.regex.Pattern;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.es.config.bsentity.BsPathMapping;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.helper.PathMappingHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -56,7 +56,7 @@ public class PathMapping extends BsPathMapping {
asDocMeta().version(version);
}
public String process(final String input) {
public String process(final PathMappingHelper pathMappingHelper, final String input) {
if (regexPattern == null) {
regexPattern = Pattern.compile(getRegex());
}
@ -64,7 +64,7 @@ public class PathMapping extends BsPathMapping {
if (matcher.find()) {
if (pathMapper == null) {
final String replacement = StringUtil.isNotBlank(getReplacement()) ? getReplacement() : StringUtil.EMPTY;
pathMapper = ComponentUtil.getPathMappingHelper().createPathMatcher(matcher, replacement);
pathMapper = pathMappingHelper.createPathMatcher(matcher, replacement);
}
try {
return pathMapper.apply(input, matcher);

View file

@ -157,7 +157,7 @@ public class PathMappingHelper {
String newUrl = url;
for (final PathMapping pathMapping : pathMappingList) {
if (matchUserAgent(pathMapping)) {
newUrl = pathMapping.process(newUrl);
newUrl = pathMapping.process(this, newUrl);
}
}
return newUrl;