KickJava   Java API By Example, From Geeks To Geeks.

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


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

18 public class URLSpideredOkEvent extends URLRelatedBaseEventImpl {
19
20     protected String JavaDoc mimeType;
21     protected int timeMs;
22     protected int size;
23     protected byte[] bytes;
24     protected int httpStatus;
25     protected URLConnection JavaDoc urlConnection;
26     protected HTTPHeader[] headers;
27
28     public URLSpideredOkEvent(SpiderContext context, URL JavaDoc url, int httpStatus, URLConnection JavaDoc urlConnection, String JavaDoc mimeType, int timeMs, int size, byte[] bytes, HTTPHeader[] headers) {
29         super(context, url);
30         this.mimeType = mimeType;
31         this.timeMs = timeMs;
32         this.size = size;
33         this.bytes = bytes;
34         this.httpStatus = httpStatus;
35         this.urlConnection = urlConnection;
36         this.headers = headers;
37     }
38
39     public byte[] getBytes() {
40         return bytes;
41     }
42
43     public String JavaDoc toString() {
44         return "url spidered : " + url + " (" + httpStatus + "," + mimeType + "," + timeMs + " ms," + size + " bytes )";
45     }
46
47     public void accept(URL JavaDoc url, CoreEventVisitor visitor) {
48         visitor.visit(url, this);
49     }
50
51     public URLConnection JavaDoc getURLConnection() {
52         return urlConnection;
53     }
54
55     public int getSize() {
56         return size;
57     }
58
59     public String JavaDoc getMimeType() {
60         return mimeType;
61     }
62
63     public int getHttpStatus() {
64         return httpStatus;
65     }
66
67     public int getTimeMs() {
68         return timeMs;
69     }
70
71     public HTTPHeader[] getHeaders ( ) {
72         return headers;
73     }
74 }
75
Popular Tags