01: package net.matuschek.http;
02:
03: import java.io.IOException;
04: import java.io.Writer;
05:
06: /*********************************************
07: Copyright (c) 2001 by Daniel Matuschek
08: *********************************************/
09:
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 wr;
21:
22: public URLLogger(Writer wr) {
23: this .wr = wr;
24: }
25:
26: public void processDocument(HttpDoc doc) throws DocManagerException {
27: try {
28: wr.write(doc.getURL().toString());
29: wr.write("\n");
30: } catch (IOException e) {
31: throw new DocManagerException("IOError: " + e.getMessage());
32: }
33: }
34:
35: }
|