KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > matuschek > http > URLLogger


1 package net.matuschek.http;
2
3 import java.io.IOException JavaDoc;
4 import java.io.Writer JavaDoc;
5 /*********************************************
6     Copyright (c) 2001 by Daniel Matuschek
7 *********************************************/

8
9
10 /**
11  * Simple document manager that logs the URL of the document to
12  * a given Writer
13  *
14  * @author Daniel Matuschek
15  * @version $Revision: 1.4 $
16  */

17 public class URLLogger extends AbstractHttpDocManager {
18   
19   /** Writer to write to */
20   private Writer JavaDoc wr;
21
22   public URLLogger(Writer JavaDoc wr) {
23     this.wr = wr;
24   }
25
26   public void processDocument(HttpDoc doc)
27     throws DocManagerException
28   {
29     try {
30       wr.write(doc.getURL().toString());
31       wr.write("\n");
32     } catch (IOException JavaDoc e) {
33       throw new DocManagerException("IOError: "+e.getMessage());
34     }
35   }
36
37 }
38
Popular Tags