01: package net.javacoding.jspider.mod.rule;
02:
03: import net.javacoding.jspider.api.model.Decision;
04: import net.javacoding.jspider.api.model.Site;
05: import net.javacoding.jspider.core.SpiderContext;
06: import net.javacoding.jspider.core.rule.impl.BaseRuleImpl;
07: import net.javacoding.jspider.core.model.DecisionInternal;
08:
09: import java.net.URL;
10:
11: /**
12: * $Id: BaseURLOnlyRule.java,v 1.1 2003/04/03 16:10:49 vanrogu Exp $
13: *
14: * @author Günther Van Roey.
15: */
16: public class BaseURLOnlyRule extends BaseRuleImpl {
17:
18: public Decision apply(SpiderContext context, Site currentSite,
19: URL url) {
20: boolean equals = context.getBaseURL().equals(url);
21: if (equals) {
22: return new DecisionInternal(Decision.RULE_ACCEPT,
23: "url accepted");
24: } else {
25: return new DecisionInternal(Decision.RULE_IGNORE,
26: "url ignored because it is not the base url");
27: }
28: }
29:
30: }
|