View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.access.spi;
15  
16  import ch.qos.logback.core.spi.DeferredProcessingAware;
17  
18  import javax.servlet.http.HttpServletRequest;
19  import javax.servlet.http.HttpServletResponse;
20  import java.util.Enumeration;
21  import java.util.List;
22  import java.util.Map;
23  
24  // Contributors:  Joern Huxhorn (see also bug #110)
25  
26  /**
27   * The Access module's internal representation of logging events. When the
28   * logging component instance is called in the container to log then a
29   * <code>AccessEvent</code> instance is created. This instance is passed around
30   * to the different logback components.
31   *
32   * @author Ceki G&uuml;lc&uuml;
33   * @author S&eacute;bastien Pennec
34   * @author J&ouml;rn Huxhorn
35   */
36  public interface IAccessEvent extends DeferredProcessingAware {
37  
38      String NA = "-";
39      int SENTINEL = -1;
40  
41      /**
42       * Returns the underlying HttpServletRequest. After serialization the returned
43       * value will be null.
44       *
45       * @return
46       */
47      HttpServletRequest getRequest();
48  
49      /**
50       * Returns the underlying HttpServletResponse. After serialization the returned
51       * value will be null.
52       *
53       * @return
54       */
55      HttpServletResponse getResponse();
56  
57      /**
58       * The number of milliseconds elapsed from 1/1/1970 until logging event was
59       * created.
60       */
61      long getTimeStamp();
62  
63      /**
64       * The sequence number associated with this event.
65       * 
66       * <p>
67       * Sequence numbers, if present, should be increasing monotonically.
68       * 
69       * @since 1.3.0
70       */
71  
72      long getSequenceNumber();
73  
74      /**
75       * The time elapsed between receiving the request and logging it in
76       * milliseconds.
77       */
78      long getElapsedTime();
79  
80      /**
81       * The number of seconds elapsed between receiving the request and logging it.
82       */
83      long getElapsedSeconds();
84  
85      String getRequestURI();
86  
87      /**
88       * The first line of the request.
89       */
90      String getRequestURL();
91  
92      String getRemoteHost();
93  
94      String getRemoteUser();
95  
96      String getProtocol();
97  
98      String getMethod();
99  
100     String getServerName();
101 
102     String getSessionID();
103 
104     void setThreadName(String threadName);
105 
106     String getThreadName();
107 
108     String getQueryString();
109 
110     String getRemoteAddr();
111 
112     String getRequestHeader(String key);
113 
114     Enumeration<String> getRequestHeaderNames();
115 
116     Map<String, String> getRequestHeaderMap();
117 
118     Map<String, String[]> getRequestParameterMap();
119 
120     String getAttribute(String key);
121 
122     String[] getRequestParameter(String key);
123 
124     String getCookie(String key);
125 
126     long getContentLength();
127 
128     int getStatusCode();
129 
130     String getRequestContent();
131 
132     String getResponseContent();
133 
134     int getLocalPort();
135 
136     ServerAdapter getServerAdapter();
137 
138     String getResponseHeader(String key);
139 
140     Map<String, String> getResponseHeaderMap();
141 
142     List<String> getResponseHeaderNameList();
143 }