001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2013-2015 ForgeRock AS
025 */
026package org.opends.server.loggers;
027
028/**
029 * Contains the information required for logging the HTTP request.
030 */
031public interface HTTPRequestInfo
032{
033
034  /**
035   * Returns the server's host.
036   *
037   * @return the serverAddress
038   */
039  String getServerAddress();
040
041  /**
042   * Returns the server's host.
043   *
044   * @return the serverHost
045   */
046  String getServerHost();
047
048  /**
049   * Returns the server's port.
050   *
051   * @return the serverPort
052   */
053  int getServerPort();
054
055  /**
056   * Returns the client's address.
057   *
058   * @return the clientAddress
059   */
060  String getClientAddress();
061
062  /**
063   * Returns the client's host.
064   *
065   * @return the clientHost
066   */
067  String getClientHost();
068
069  /**
070   * Returns the client's port.
071   *
072   * @return the clientPort
073   */
074  int getClientPort();
075
076  /**
077   * Returns the protocol used for this request.
078   *
079   * @return the protocol
080   */
081  String getProtocol();
082
083  /**
084   * Returns the HTTP method/verb used for this request.
085   *
086   * @return the method
087   */
088  String getMethod();
089
090  /**
091   * Returns the query issued by the client.
092   *
093   * @return the query
094   */
095  String getQuery();
096
097  /**
098   * Returns the user agent used by the client.
099   *
100   * @return the userAgent
101   */
102  String getUserAgent();
103
104  /**
105   * Returns the username that was used to authenticate.
106   *
107   * @return the authUser
108   */
109  String getAuthUser();
110
111  /**
112   * Sets the username that was used to authenticate.
113   *
114   * @param authUser
115   *          the authUser to set
116   */
117  void setAuthUser(String authUser);
118
119  /**
120   * Returns the HTTP status code returned to the client.
121   *
122   * @return the statusCode
123   */
124  int getStatusCode();
125
126  /**
127   * Returns the unique identifier that has been assigned to the client
128   * connection for this HTTP request.
129   *
130   * @return The unique identifier that has been assigned to the client
131   *         connection for this HTTP request
132   */
133  long getConnectionID();
134
135  /**
136   * Returns the total processing time for this HTTP request.
137   *
138   * @return the total processing time for this HTTP request
139   */
140  long getTotalProcessingTime();
141
142  /**
143   * Returns the transactionId for this request.
144   *
145   * @return the transactionId
146   */
147  String getTransactionId();
148
149  /**
150   * Logs the current request info in the HTTP access log.
151   *
152   * @param statusCode
153   *          the HTTP status code that was returned to the client.
154   */
155  void log(int statusCode);
156
157}