Class Access
- java.lang.Object
-
- org.apache.synapse.transport.http.access.Access
-
public class Access extends Object
The class to handle the HTTP Access Logs, patterns and the major functionality. Major Code segment borrowed from Apache Tomcat's org.apache.catalina.valves.AccessLogValve with thanks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAccess.AcceptCharSetElementwrite the Accept Character Set Element - %Sprotected static classAccess.AcceptElementwrite the Accept Element - %Cprotected static classAccess.AcceptEncodingElementwrite the Accept Encoding Element - %eprotected static classAccess.AcceptLanguageElementwrite the Accept Language Element - %Lprotected static interfaceAccess.AccessLogElementAccessLogElement writes the partial message into the buffer.protected static classAccess.ByteSentElementwrite bytes sent, excluding HTTP headers - %b, %Bprotected static classAccess.ConnectionElementwrite the Connection Element - %xprotected static classAccess.ContentEncodingElementwrite the Content Encoding Element - %nprotected static classAccess.ContentTypeElementwrite the Content Type Element - %Tprotected static classAccess.CookieElementwrite a specific cookie - %{xxx}cprotected classAccess.DateAndTimeElementwrite date and time, in Common Log Format - %tprotected static classAccess.HeaderElementwrite incoming headers - %{xxx}iprotected static classAccess.HostElementwrite remote host name - %hprotected static classAccess.HttpStatusCodeElementwrite HTTP status code of the response - %sprotected static classAccess.KeepAliveElementwrite the Keep Alive Element - %kprotected static classAccess.LocalAddrElementwrite local IP address - %Aprotected static classAccess.LocalServerNameElementwrite local server name - %vprotected static classAccess.LogicalUserNameElementwrite remote logical username from identd (always returns '-') - %lprotected static classAccess.MethodElementwrite request method (GET, POST, etc.) - %mprotected static classAccess.RefererElementwrite the referer - %fprotected static classAccess.RequestAttributeElementwrite an attribute in the ServletRequest - %{xxx}r %Rprotected static classAccess.RequestElementwrite first line of the request (method and request URI) - %rprotected static classAccess.RequestURIElementwrite requested URL path - %Uprotected static classAccess.ResponseHeaderElementwrite a specific response header - %{xxx}oprotected static classAccess.ServerElementwrite the Server Element - %Zprotected static classAccess.StringElementwrite any stringprotected static classAccess.TransferEncodingElementwrite the Transfer Encoding Element - %Eprotected static classAccess.UserAgentElementwrite the user agent - %aprotected static classAccess.UserElementwrite remote user that was authenticated (if any), else '-' - %uprotected static classAccess.VaryElementwrite the Vary Element - %V
-
Field Summary
Fields Modifier and Type Field Description protected Access.AccessLogElement[]logElementsArray of AccessLogElement, they will be used to make log message.protected Stringpattern
-
Constructor Summary
Constructors Constructor Description Access(org.apache.commons.logging.Log log, AccessLogger accessLogger)Constructor of AccessLog.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAccessToQueue(org.apache.http.HttpRequest request)Adds the accesses to the queue.voidaddAccessToQueue(org.apache.http.HttpResponse response)Adds the accesses to the queue.protected Access.AccessLogElement[]createLogElements()parse pattern string and create the array of AccessLogElementstatic StringgetAcceptCharSetElement(org.apache.http.HttpMessage message)static StringgetAcceptElement(org.apache.http.HttpMessage message)static StringgetAcceptEncodingElement(org.apache.http.HttpMessage message)static StringgetAcceptLanguageElement(org.apache.http.HttpMessage message)static StringgetConnectionElement(org.apache.http.HttpMessage message)static StringgetContentEncodingElement(org.apache.http.HttpMessage message)static StringgetContentTypeElement(org.apache.http.HttpMessage message)static StringgetCookieElement(org.apache.http.HttpMessage message)protected static StringgetHeaderValues(org.apache.http.HttpMessage message, String name)gets the header values from the given message, with the given name.static StringgetHostElement(org.apache.http.HttpMessage message)static StringgetKeepAliveElement(org.apache.http.HttpMessage message)static StringgetLogicalUserNameElement(org.apache.http.HttpMessage message)protected static StringgetParam(org.apache.http.HttpMessage message, String paramName)static StringgetRefererElement(org.apache.http.HttpMessage message)static StringgetRemoteAddr(org.apache.http.HttpMessage message)static StringgetServerElement(org.apache.http.HttpMessage message)static StringgetTransferEncodingElement(org.apache.http.HttpMessage message)static StringgetUserAgentElement(org.apache.http.HttpMessage message)static StringgetUserNameElement(org.apache.http.HttpMessage message)static StringgetVaryElement(org.apache.http.HttpMessage message)voidlog(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response)The log method that is called from the NHttpClient and Server connection classes.voidlog(HttpRequestWrapper request, HttpResponseWrapper response)The log method that is called from the NHttpClient and Server connection classes.voidlogAccesses()logs the request and response accesses.
-
-
-
Field Detail
-
logElements
protected Access.AccessLogElement[] logElements
Array of AccessLogElement, they will be used to make log message.
-
pattern
protected String pattern
-
-
Constructor Detail
-
Access
public Access(org.apache.commons.logging.Log log, AccessLogger accessLogger)Constructor of AccessLog. AccessHandler has a static object of Access.- Parameters:
log- - Log passed as a param. Default is Log of the same class.accessLogger- - AccessLogger Object
-
-
Method Detail
-
addAccessToQueue
public void addAccessToQueue(org.apache.http.HttpRequest request)
Adds the accesses to the queue.- Parameters:
request- - HttpRequest
-
addAccessToQueue
public void addAccessToQueue(org.apache.http.HttpResponse response)
Adds the accesses to the queue.- Parameters:
response- - HttpResponse
-
logAccesses
public void logAccesses()
logs the request and response accesses.
-
log
public void log(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response)The log method that is called from the NHttpClient and Server connection classes.- Parameters:
request- - HttpRequestresponse- - HttpResponse
-
getHeaderValues
protected static String getHeaderValues(org.apache.http.HttpMessage message, String name)
gets the header values from the given message, with the given name.- Parameters:
message- - The message, HttpRequest or HttpResponsename- - The header, which we need to get the value of.- Returns:
- - The header value.
-
getHostElement
public static String getHostElement(org.apache.http.HttpMessage message)
-
getLogicalUserNameElement
public static String getLogicalUserNameElement(org.apache.http.HttpMessage message)
-
getUserNameElement
public static String getUserNameElement(org.apache.http.HttpMessage message)
-
getCookieElement
public static String getCookieElement(org.apache.http.HttpMessage message)
-
getRefererElement
public static String getRefererElement(org.apache.http.HttpMessage message)
-
getUserAgentElement
public static String getUserAgentElement(org.apache.http.HttpMessage message)
-
getAcceptElement
public static String getAcceptElement(org.apache.http.HttpMessage message)
-
getAcceptLanguageElement
public static String getAcceptLanguageElement(org.apache.http.HttpMessage message)
-
getAcceptEncodingElement
public static String getAcceptEncodingElement(org.apache.http.HttpMessage message)
-
getAcceptCharSetElement
public static String getAcceptCharSetElement(org.apache.http.HttpMessage message)
-
getConnectionElement
public static String getConnectionElement(org.apache.http.HttpMessage message)
-
getContentTypeElement
public static String getContentTypeElement(org.apache.http.HttpMessage message)
-
getKeepAliveElement
public static String getKeepAliveElement(org.apache.http.HttpMessage message)
-
getTransferEncodingElement
public static String getTransferEncodingElement(org.apache.http.HttpMessage message)
-
getContentEncodingElement
public static String getContentEncodingElement(org.apache.http.HttpMessage message)
-
getVaryElement
public static String getVaryElement(org.apache.http.HttpMessage message)
-
getServerElement
public static String getServerElement(org.apache.http.HttpMessage message)
-
getRemoteAddr
public static String getRemoteAddr(org.apache.http.HttpMessage message)
-
createLogElements
protected Access.AccessLogElement[] createLogElements()
parse pattern string and create the array of AccessLogElement- Returns:
- Array of AccessLogElement
-
log
public void log(HttpRequestWrapper request, HttpResponseWrapper response)
The log method that is called from the NHttpClient and Server connection classes. This method is used to log the request/response with the actual date of operation.- Parameters:
request- - HttpRequestWrapperresponse- - HttpResponseWrapper
-
-