KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > server > log > AbstractAccessLog


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.server.log;
31
32 import com.caucho.config.ConfigException;
33 import com.caucho.config.types.InitProgram;
34 import com.caucho.log.Log;
35 import com.caucho.vfs.Path;
36
37 import javax.servlet.ServletContext JavaDoc;
38 import javax.servlet.ServletException JavaDoc;
39 import javax.servlet.http.HttpServletRequest JavaDoc;
40 import javax.servlet.http.HttpServletResponse JavaDoc;
41 import java.io.IOException JavaDoc;
42 import java.util.logging.Logger JavaDoc;
43
44 /**
45  * Represents an log of every top-level request to the server.
46  */

47 abstract public class AbstractAccessLog {
48   protected static final Logger JavaDoc log = Log.open(AbstractAccessLog.class);
49
50   protected Path _path;
51
52   protected String JavaDoc _pathFormat;
53
54   /**
55    * Returns the access-log's path.
56    */

57   public Path getPath()
58   {
59     return _path;
60   }
61
62   /**
63    * Sets the access-log's path.
64    */

65   public void setPath(Path path)
66   {
67     _path = path;
68   }
69
70   /**
71    * Returns the formatted path
72    */

73   public String JavaDoc getPathFormat()
74   {
75     return _pathFormat;
76   }
77
78   /**
79    * Sets the formatted path.
80    */

81   public void setPathFormat(String JavaDoc pathFormat)
82     throws ConfigException
83   {
84     _pathFormat = pathFormat;
85   }
86
87   /**
88    * Sets the access-log's path (backwards compatibility).
89    */

90   public void setId(Path path)
91   {
92     setPath(path);
93   }
94
95   public void addInit(InitProgram init)
96     throws Throwable JavaDoc
97   {
98     init.init(this);
99   }
100
101   /**
102    * Initialize the log.
103    */

104   public void init()
105     throws ServletException JavaDoc, IOException JavaDoc
106   {
107   }
108
109   /**
110    * Logs a request using the current format.
111    *
112    * @param request the servlet request.
113    * @param response the servlet response.
114    */

115   public abstract void log(HttpServletRequest JavaDoc request,
116                            HttpServletResponse JavaDoc response,
117                            ServletContext JavaDoc application)
118     throws IOException JavaDoc;
119
120   /**
121    * Flushes the log.
122    */

123   public void flush()
124   {
125   }
126
127   /**
128    * Cleanup the log.
129    */

130   public void destroy()
131     throws IOException JavaDoc
132   {
133   }
134 }
135
Popular Tags