コード例 #1
0
ファイル: InfoTool.java プロジェクト: lichangshu/spider4java
 public void notify(JSpiderEvent event) {
   if (event instanceof ResourceFetchedEvent) {
     ResourceFetchedEvent rfe = (ResourceFetchedEvent) event;
     System.out.println("URL          : " + rfe.getResource().getURL());
     System.out.println("HTTP Headers : ");
     HTTPHeader[] headers = rfe.getResource().getHeaders();
     for (int i = 0; i < headers.length; i++) {
       HTTPHeader header = headers[i];
       System.out.println("  " + header.getName() + ":" + header.getValue());
     }
     System.out.println("Mime Type    : " + rfe.getResource().getMime());
     System.out.println("Size         : " + rfe.getResource().getSize());
     System.out.println("Time (ms)    : " + rfe.getResource().getTimeMs());
   }
 }