KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > event > impl > URLSpideredErrorEvent


1 package net.javacoding.jspider.core.event.impl;
2
3
4 import net.javacoding.jspider.core.SpiderContext;
5 import net.javacoding.jspider.core.event.CoreEventVisitor;
6 import net.javacoding.jspider.api.model.HTTPHeader;
7
8 import java.net.URL JavaDoc;
9 import java.net.URLConnection JavaDoc;
10
11
12 /**
13  *
14  * $Id: URLSpideredErrorEvent.java,v 1.4 2003/04/01 19:44:37 vanrogu Exp $
15  *
16  * @author Günther Van Roey
17  */

18 public class URLSpideredErrorEvent extends URLRelatedBaseEventImpl {
19
20     protected Exception JavaDoc error;
21     protected int httpStatus;
22     protected HTTPHeader[] headers;
23
24     public URLSpideredErrorEvent(SpiderContext context, URL JavaDoc url, int httpStatus, URLConnection JavaDoc urlConnection, HTTPHeader[] headers, Exception JavaDoc error) {
25         super(context, url);
26         this.error = error;
27         this.httpStatus = httpStatus;
28         this.headers = headers;
29     }
30
31     public String JavaDoc toString() {
32         return "url spidered : " + url + " ERROR : " + error.getClass() + ((httpStatus != 0) ? " (HTTP Status: " + httpStatus + ")" : "");
33     }
34
35     public void accept(URL JavaDoc url, CoreEventVisitor visitor) {
36         visitor.visit(url, this);
37     }
38
39     public HTTPHeader[] getHeaders ( ) {
40         return headers;
41     }
42
43     public int getHttpStatus() {
44         return httpStatus;
45     }
46
47     public Exception JavaDoc getException() {
48         return error;
49     }
50
51 }
52
Popular Tags