01: package net.javacoding.jspider.core.event.impl;
02:
03: import net.javacoding.jspider.api.model.HTTPHeader;
04: import net.javacoding.jspider.core.SpiderContext;
05: import net.javacoding.jspider.core.event.CoreEventVisitor;
06:
07: import java.net.URL;
08: import java.net.URLConnection;
09:
10: /**
11: *
12: * $Id: URLSpideredOkEvent.java,v 1.6 2003/03/27 17:44:02 vanrogu Exp $
13: *
14: * @author Günther Van Roey
15: */
16: public class URLSpideredOkEvent extends URLRelatedBaseEventImpl {
17:
18: protected String mimeType;
19: protected int timeMs;
20: protected int size;
21: protected byte[] bytes;
22: protected int httpStatus;
23: protected URLConnection urlConnection;
24: protected HTTPHeader[] headers;
25:
26: public URLSpideredOkEvent(SpiderContext context, URL url,
27: int httpStatus, URLConnection urlConnection,
28: String mimeType, int timeMs, int size, byte[] bytes,
29: HTTPHeader[] headers) {
30: super (context, url);
31: this .mimeType = mimeType;
32: this .timeMs = timeMs;
33: this .size = size;
34: this .bytes = bytes;
35: this .httpStatus = httpStatus;
36: this .urlConnection = urlConnection;
37: this .headers = headers;
38: }
39:
40: public byte[] getBytes() {
41: return bytes;
42: }
43:
44: public String toString() {
45: return "url spidered : " + url + " (" + httpStatus + ","
46: + mimeType + "," + timeMs + " ms," + size + " bytes )";
47: }
48:
49: public void accept(URL url, CoreEventVisitor visitor) {
50: visitor.visit(url, this );
51: }
52:
53: public URLConnection getURLConnection() {
54: return urlConnection;
55: }
56:
57: public int getSize() {
58: return size;
59: }
60:
61: public String getMimeType() {
62: return mimeType;
63: }
64:
65: public int getHttpStatus() {
66: return httpStatus;
67: }
68:
69: public int getTimeMs() {
70: return timeMs;
71: }
72:
73: public HTTPHeader[] getHeaders() {
74: return headers;
75: }
76: }
|