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