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