Class Access
java.lang.Object
org.apache.synapse.transport.http.access.Access
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 ClassesModifier and TypeClassDescriptionprotected static classwrite the Accept Character Set Element - %Sprotected static classwrite the Accept Element - %Cprotected static classwrite the Accept Encoding Element - %eprotected static classwrite the Accept Language Element - %Lprotected static interfaceAccessLogElement writes the partial message into the buffer.protected static classwrite bytes sent, excluding HTTP headers - %b, %Bprotected static classwrite the Connection Element - %xprotected static classwrite the Content Encoding Element - %nprotected static classwrite the Content Type Element - %Tprotected static classwrite a specific cookie - %{xxx}cprotected classwrite date and time, in Common Log Format - %tprotected static classwrite incoming headers - %{xxx}iprotected static classwrite remote host name - %hprotected static classwrite HTTP status code of the response - %sprotected static classwrite the Keep Alive Element - %kprotected static classwrite local IP address - %Aprotected static classwrite local server name - %vprotected static classwrite remote logical username from identd (always returns '-') - %lprotected static classwrite request method (GET, POST, etc.) - %mprotected static classwrite the referer - %fprotected static classwrite an attribute in the ServletRequest - %{xxx}r %Rprotected static classwrite first line of the request (method and request URI) - %rprotected static classwrite requested URL path - %Uprotected static classwrite a specific response header - %{xxx}oprotected static classwrite the Server Element - %Zprotected static classwrite any stringprotected static classwrite the Transfer Encoding Element - %Eprotected static classwrite the user agent - %aprotected static classwrite remote user that was authenticated (if any), else '-' - %uprotected static classwrite the Vary Element - %V -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Access.AccessLogElement[]Array of AccessLogElement, they will be used to make log message.protected String -
Constructor Summary
ConstructorsConstructorDescriptionAccess(org.apache.commons.logging.Log log, AccessLogger accessLogger) Constructor of AccessLog. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAccessToQueue(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[]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 Stringstatic 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.voidlogs the request and response accesses.
-
Field Details
-
logElements
Array of AccessLogElement, they will be used to make log message. -
pattern
-
-
Constructor Details
-
Access
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 Details
-
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
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.
-
getParam
-
getHostElement
-
getLogicalUserNameElement
-
getUserNameElement
-
getCookieElement
-
getRefererElement
-
getUserAgentElement
-
getAcceptElement
-
getAcceptLanguageElement
-
getAcceptEncodingElement
-
getAcceptCharSetElement
-
getConnectionElement
-
getContentTypeElement
-
getKeepAliveElement
-
getTransferEncodingElement
-
getContentEncodingElement
-
getVaryElement
-
getServerElement
-
getRemoteAddr
-
createLogElements
parse pattern string and create the array of AccessLogElement- Returns:
- Array of AccessLogElement
-
log
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
-