001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.access.spi;
015
016import ch.qos.logback.core.spi.DeferredProcessingAware;
017
018import javax.servlet.http.HttpServletRequest;
019import javax.servlet.http.HttpServletResponse;
020import java.util.Enumeration;
021import java.util.List;
022import java.util.Map;
023
024// Contributors:  Joern Huxhorn (see also bug #110)
025
026/**
027 * The Access module's internal representation of logging events. When the
028 * logging component instance is called in the container to log then a
029 * <code>AccessEvent</code> instance is created. This instance is passed around
030 * to the different logback components.
031 *
032 * @author Ceki G&uuml;lc&uuml;
033 * @author S&eacute;bastien Pennec
034 * @author J&ouml;rn Huxhorn
035 */
036public interface IAccessEvent extends DeferredProcessingAware {
037
038    String NA = "-";
039    int SENTINEL = -1;
040
041    /**
042     * Returns the underlying HttpServletRequest. After serialization the returned
043     * value will be null.
044     *
045     * @return
046     */
047    HttpServletRequest getRequest();
048
049    /**
050     * Returns the underlying HttpServletResponse. After serialization the returned
051     * value will be null.
052     *
053     * @return
054     */
055    HttpServletResponse getResponse();
056
057    /**
058     * The number of milliseconds elapsed from 1/1/1970 until logging event was
059     * created.
060     */
061    long getTimeStamp();
062
063    /**
064     * The sequence number associated with this event.
065     * 
066     * <p>
067     * Sequence numbers, if present, should be increasing monotonically.
068     * 
069     * @since 1.3.0
070     */
071
072    long getSequenceNumber();
073
074    /**
075     * The time elapsed between receiving the request and logging it in
076     * milliseconds.
077     */
078    long getElapsedTime();
079
080    /**
081     * The number of seconds elapsed between receiving the request and logging it.
082     */
083    long getElapsedSeconds();
084
085    String getRequestURI();
086
087    /**
088     * The first line of the request.
089     */
090    String getRequestURL();
091
092    String getRemoteHost();
093
094    String getRemoteUser();
095
096    String getProtocol();
097
098    String getMethod();
099
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}