01: package net.javacoding.jspider.core.event.impl;
02:
03: import net.javacoding.jspider.core.SpiderContext;
04: import net.javacoding.jspider.core.event.CoreEventVisitor;
05: import net.javacoding.jspider.api.model.HTTPHeader;
06:
07: import java.net.URL;
08: import java.net.URLConnection;
09:
10: /**
11: *
12: * $Id: URLSpideredErrorEvent.java,v 1.4 2003/04/01 19:44:37 vanrogu Exp $
13: *
14: * @author Günther Van Roey
15: */
16: public class URLSpideredErrorEvent extends URLRelatedBaseEventImpl {
17:
18: protected Exception error;
19: protected int httpStatus;
20: protected HTTPHeader[] headers;
21:
22: public URLSpideredErrorEvent(SpiderContext context, URL url,
23: int httpStatus, URLConnection urlConnection,
24: HTTPHeader[] headers, Exception error) {
25: super (context, url);
26: this .error = error;
27: this .httpStatus = httpStatus;
28: this .headers = headers;
29: }
30:
31: public String toString() {
32: return "url spidered : "
33: + url
34: + " ERROR : "
35: + error.getClass()
36: + ((httpStatus != 0) ? " (HTTP Status: " + httpStatus
37: + ")" : "");
38: }
39:
40: public void accept(URL url, CoreEventVisitor visitor) {
41: visitor.visit(url, this );
42: }
43:
44: public HTTPHeader[] getHeaders() {
45: return headers;
46: }
47:
48: public int getHttpStatus() {
49: return httpStatus;
50: }
51:
52: public Exception getException() {
53: return error;
54: }
55:
56: }
|