01: package net.javacoding.jspider.mod.rule;
02:
03: import net.javacoding.jspider.core.rule.impl.BaseRuleImpl;
04: import net.javacoding.jspider.core.SpiderContext;
05: import net.javacoding.jspider.core.model.DecisionInternal;
06: import net.javacoding.jspider.api.model.Decision;
07: import net.javacoding.jspider.api.model.Site;
08:
09: import java.net.URL;
10:
11: /**
12: * $Id: NoURLParamsRule.java,v 1.1 2003/04/07 15:51:01 vanrogu Exp $
13: */
14: public class NoURLParamsRule extends BaseRuleImpl {
15:
16: public Decision apply(SpiderContext context, Site currentSite,
17: URL url) {
18: Decision decision = null;
19:
20: String query = url.getQuery();
21: if (query != null && query.trim().length() > 0) {
22: decision = new DecisionInternal(Decision.RULE_IGNORE,
23: "url contains parameters, not accepted");
24: } else {
25: decision = new DecisionInternal(Decision.RULE_ACCEPT,
26: "url contains no parameters, accepted");
27: }
28: return decision;
29: }
30:
31: }
|