Commit 211ac743 authored by yihua.huang's avatar yihua.huang

use group 0 of targetUrl instead of group 1 #588

parent 9b773060
...@@ -74,7 +74,7 @@ class ModelPageProcessor implements PageProcessor { ...@@ -74,7 +74,7 @@ class ModelPageProcessor implements PageProcessor {
for (Pattern targetUrlPattern : urlPatterns) { for (Pattern targetUrlPattern : urlPatterns) {
Matcher matcher = targetUrlPattern.matcher(link); Matcher matcher = targetUrlPattern.matcher(link);
if (matcher.find()) { if (matcher.find()) {
page.addTargetRequest(new Request(matcher.group(1))); page.addTargetRequest(new Request(matcher.group(0)));
} }
} }
} }
......
...@@ -163,12 +163,12 @@ class PageModelExtractor { ...@@ -163,12 +163,12 @@ class PageModelExtractor {
private void initClassExtractors() { private void initClassExtractors() {
Annotation annotation = clazz.getAnnotation(TargetUrl.class); Annotation annotation = clazz.getAnnotation(TargetUrl.class);
if (annotation == null) { if (annotation == null) {
targetUrlPatterns.add(Pattern.compile("(.*)")); targetUrlPatterns.add(Pattern.compile(".*"));
} else { } else {
TargetUrl targetUrl = (TargetUrl) annotation; TargetUrl targetUrl = (TargetUrl) annotation;
String[] value = targetUrl.value(); String[] value = targetUrl.value();
for (String s : value) { for (String s : value) {
targetUrlPatterns.add(Pattern.compile("(" + s.replace(".", "\\.").replace("*", "[^\"'#]*") + ")")); targetUrlPatterns.add(Pattern.compile(s.replace(".", "\\.").replace("*", "[^\"'#]*")));
} }
if (!targetUrl.sourceRegion().equals("")) { if (!targetUrl.sourceRegion().equals("")) {
targetUrlRegionSelector = new XpathSelector(targetUrl.sourceRegion()); targetUrlRegionSelector = new XpathSelector(targetUrl.sourceRegion());
...@@ -179,7 +179,7 @@ class PageModelExtractor { ...@@ -179,7 +179,7 @@ class PageModelExtractor {
HelpUrl helpUrl = (HelpUrl) annotation; HelpUrl helpUrl = (HelpUrl) annotation;
String[] value = helpUrl.value(); String[] value = helpUrl.value();
for (String s : value) { for (String s : value) {
helpUrlPatterns.add(Pattern.compile("(" + s.replace(".", "\\.").replace("*", "[^\"'#]*") + ")")); helpUrlPatterns.add(Pattern.compile(s.replace(".", "\\.").replace("*", "[^\"'#]*")));
} }
if (!helpUrl.sourceRegion().equals("")) { if (!helpUrl.sourceRegion().equals("")) {
helpUrlRegionSelector = new XpathSelector(helpUrl.sourceRegion()); helpUrlRegionSelector = new XpathSelector(helpUrl.sourceRegion());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment