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
030 * around 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 time elapsed between receiving the request and logging it in milliseconds.
065     */
066    long getElapsedTime();
067
068    /**
069    * The number of seconds elapsed between receiving the request and logging it.
070    */
071    long getElapsedSeconds();
072
073    String getRequestURI();
074
075    /**
076     * The first line of the request.
077     */
078    String getRequestURL();
079
080    String getRemoteHost();
081
082    String getRemoteUser();
083
084    String getProtocol();
085
086    String getMethod();
087
088    String getServerName();
089
090    String getSessionID();
091
092    void setThreadName(String threadName);
093    String getThreadName();
094    
095    String getQueryString();
096    
097    String getRemoteAddr();
098
099    String getRequestHeader(String key);
100
101    Enumeration<String> getRequestHeaderNames();
102
103    Map<String, String> getRequestHeaderMap();
104
105    Map<String, String[]> getRequestParameterMap();
106
107    String getAttribute(String key);
108
109    String[] getRequestParameter(String key);
110
111    String getCookie(String key);
112
113    long getContentLength();
114
115    int getStatusCode();
116
117    String getRequestContent();
118
119    String getResponseContent();
120
121    int getLocalPort();
122
123    ServerAdapter getServerAdapter();
124
125    String getResponseHeader(String key);
126
127    Map<String, String> getResponseHeaderMap();
128
129    List<String> getResponseHeaderNameList();
130}