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 ; 9 import java.net.URLConnection ; 10 11 12 18 public class URLSpideredErrorEvent extends URLRelatedBaseEventImpl { 19 20 protected Exception error; 21 protected int httpStatus; 22 protected HTTPHeader[] headers; 23 24 public URLSpideredErrorEvent(SpiderContext context, URL url, int httpStatus, URLConnection urlConnection, 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 : " + url + " ERROR : " + error.getClass() + ((httpStatus != 0) ? " (HTTP Status: " + httpStatus + ")" : ""); 33 } 34 35 public void accept(URL 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 getException() { 48 return error; 49 } 50 51 } 52 | Popular Tags |