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-2016 ForgeRock AS. 015 */ 016package org.opends.server.loggers; 017 018import java.net.URI; 019 020/** 021 * Contains the information required for logging the HTTP request. 022 */ 023public interface HTTPRequestInfo 024{ 025 026 /** 027 * Returns the server's host. 028 * 029 * @return the serverAddress 030 */ 031 String getServerAddress(); 032 033 /** 034 * Returns the server's host. 035 * 036 * @return the serverHost 037 */ 038 String getServerHost(); 039 040 /** 041 * Returns the server's port. 042 * 043 * @return the serverPort 044 */ 045 int getServerPort(); 046 047 /** 048 * Returns the client's address. 049 * 050 * @return the clientAddress 051 */ 052 String getClientAddress(); 053 054 /** 055 * Returns the client's host. 056 * 057 * @return the clientHost 058 */ 059 String getClientHost(); 060 061 /** 062 * Returns the client's port. 063 * 064 * @return the clientPort 065 */ 066 int getClientPort(); 067 068 /** 069 * Returns the protocol used for this request. 070 * 071 * @return the protocol 072 */ 073 String getProtocol(); 074 075 /** 076 * Returns the HTTP method/verb used for this request. 077 * 078 * @return the method 079 */ 080 String getMethod(); 081 082 /** 083 * Returns the URI issued by the client. 084 * 085 * @return the URI 086 */ 087 URI getUri(); 088 089 /** 090 * Returns the user agent used by the client. 091 * 092 * @return the userAgent 093 */ 094 String getUserAgent(); 095 096 /** 097 * Returns the username that was used to authenticate. 098 * 099 * @return the authUser 100 */ 101 String getAuthUser(); 102 103 /** 104 * Sets the username that was used to authenticate. 105 * 106 * @param authUser 107 * the authUser to set 108 */ 109 void setAuthUser(String authUser); 110 111 /** 112 * Returns the HTTP status code returned to the client. 113 * 114 * @return the statusCode 115 */ 116 int getStatusCode(); 117 118 /** 119 * Returns the unique identifier that has been assigned to the client 120 * connection for this HTTP request. 121 * 122 * @return The unique identifier that has been assigned to the client 123 * connection for this HTTP request 124 */ 125 long getConnectionID(); 126 127 /** 128 * Returns the total processing time for this HTTP request. 129 * 130 * @return the total processing time for this HTTP request 131 */ 132 long getTotalProcessingTime(); 133 134 /** 135 * Returns the transactionId for this request. 136 * 137 * @return the transactionId 138 */ 139 String getTransactionId(); 140 141 /** 142 * Logs the current request info in the HTTP access log. 143 * 144 * @param statusCode 145 * the HTTP status code that was returned to the client. 146 */ 147 void log(int statusCode); 148 149}