KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > rule > impl > BaseURLOnlyRule


1 package net.javacoding.jspider.core.rule.impl;
2
3 import net.javacoding.jspider.api.model.Decision;
4 import net.javacoding.jspider.api.model.Site;
5 import net.javacoding.jspider.core.SpiderContext;
6 import net.javacoding.jspider.core.model.DecisionInternal;
7
8 import java.net.URL JavaDoc;
9
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, URL JavaDoc url) {
18         boolean equals = context.getBaseURL().equals(url);
19         if (equals) {
20             return new DecisionInternal(Decision.RULE_ACCEPT, "url accepted");
21         } else {
22             return new DecisionInternal(Decision.RULE_IGNORE, "url ignored because it is not the base url");
23         }
24     }
25
26 }
27
28
Popular Tags