org.apache.synapse.transport.http.access

## Class Access

- java.lang.Object
- - org.apache.synapse.transport.http.access.Access

-     public class Access
      extends java.lang.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 and Description
    --- | ---
    `protected static class` | `Access.AcceptCharSetElement` write the Accept Character Set Element - %S
    `protected static class` | `Access.AcceptElement` write the Accept Element - %C
    `protected static class` | `Access.AcceptEncodingElement` write the Accept Encoding Element - %e
    `protected static class` | `Access.AcceptLanguageElement` write the Accept Language Element - %L
    `protected static interface` | `Access.AccessLogElement` AccessLogElement writes the partial message into the buffer.
    `protected static class` | `Access.ByteSentElement` write bytes sent, excluding HTTP headers - %b, %B
    `protected static class` | `Access.ConnectionElement` write the Connection Element - %x
    `protected static class` | `Access.ContentEncodingElement` write the Content Encoding Element - %n
    `protected static class` | `Access.ContentTypeElement` write the Content Type Element - %T
    `protected static class` | `Access.CookieElement` write a specific cookie - %{xxx}c
    `protected class` | `Access.DateAndTimeElement` write date and time, in Common Log Format - %t
    `protected static class` | `Access.HeaderElement` write incoming headers - %{xxx}i
    `protected static class` | `Access.HostElement` write remote host name - %h
    `protected static class` | `Access.HttpStatusCodeElement` write HTTP status code of the response - %s
    `protected static class` | `Access.KeepAliveElement` write the Keep Alive Element - %k
    `protected static class` | `Access.LocalAddrElement` write local IP address - %A
    `protected static class` | `Access.LocalServerNameElement` write local server name - %v
    `protected static class` | `Access.LogicalUserNameElement` write remote logical username from identd (always returns '-') - %l
    `protected static class` | `Access.MethodElement` write request method (GET, POST, etc.) - %m
    `protected static class` | `Access.RefererElement` write the referer - %f
    `protected static class` | `Access.RequestAttributeElement` write an attribute in the ServletRequest - %{xxx}r %R
    `protected static class` | `Access.RequestElement` write first line of the request (method and request URI) - %r
    `protected static class` | `Access.RequestURIElement` write requested URL path - %U
    `protected static class` | `Access.ResponseHeaderElement` write a specific response header - %{xxx}o
    `protected static class` | `Access.ServerElement` write the Server Element - %Z
    `protected static class` | `Access.StringElement` write any string
    `protected static class` | `Access.TransferEncodingElement` write the Transfer Encoding Element - %E
    `protected static class` | `Access.UserAgentElement` write the user agent - %a
    `protected static class` | `Access.UserElement` write remote user that was authenticated (if any), else '-' - %u
    `protected static class` | `Access.VaryElement` write the Vary Element - %V

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Access.AccessLogElement[]` | `logElements` Array of AccessLogElement, they will be used to make log message.
    `protected java.lang.String` | `pattern`

  - ### Constructor Summary

    Constructors
    Constructor and 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 and Description
    --- | ---
    `void` | `addAccessToQueue(org.apache.http.HttpRequest request)` Adds the accesses to the queue.
    `void` | `addAccessToQueue(org.apache.http.HttpResponse response)` Adds the accesses to the queue.
    `protected Access.AccessLogElement[]` | `createLogElements()` parse pattern string and create the array of AccessLogElement
    `static java.lang.String` | `getAcceptCharSetElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getAcceptElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getAcceptEncodingElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getAcceptLanguageElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getConnectionElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getContentEncodingElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getContentTypeElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getCookieElement(org.apache.http.HttpMessage message)`
    `protected static java.lang.String` | `getHeaderValues(org.apache.http.HttpMessage message, java.lang.String name)` gets the header values from the given message, with the given name.
    `static java.lang.String` | `getHostElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getKeepAliveElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getLogicalUserNameElement(org.apache.http.HttpMessage message)`
    `protected static java.lang.String` | `getParam(org.apache.http.HttpMessage message, java.lang.String paramName)`
    `static java.lang.String` | `getRefererElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getRemoteAddr(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getServerElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getTransferEncodingElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getUserAgentElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getUserNameElement(org.apache.http.HttpMessage message)`
    `static java.lang.String` | `getVaryElement(org.apache.http.HttpMessage message)`
    `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.
    `void` | `log(HttpRequestWrapper request, HttpResponseWrapper response)` The log method that is called from the NHttpClient and Server connection classes.
    `void` | `logAccesses()` logs the request and response accesses.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logElements

          protected Access.AccessLogElement[] logElements

      Array of AccessLogElement, they will be used to make log message.

    - #### pattern

          protected java.lang.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` - - HttpRequest
        `response` - - HttpResponse

    - #### getHeaderValues

          protected static java.lang.String getHeaderValues(org.apache.http.HttpMessage message,
                                                            java.lang.String name)

      gets the header values from the given message, with the given name.
      Parameters:
        `message` - - The message, HttpRequest or HttpResponse
        `name` - - The header, which we need to get the value of.
      Returns:
        - The header value.

    - #### getParam

          protected static java.lang.String getParam(org.apache.http.HttpMessage message,
                                                     java.lang.String paramName)

    - #### getHostElement

          public static java.lang.String getHostElement(org.apache.http.HttpMessage message)

    - #### getLogicalUserNameElement

          public static java.lang.String getLogicalUserNameElement(org.apache.http.HttpMessage message)

    - #### getUserNameElement

          public static java.lang.String getUserNameElement(org.apache.http.HttpMessage message)

    - #### getCookieElement

          public static java.lang.String getCookieElement(org.apache.http.HttpMessage message)

    - #### getRefererElement

          public static java.lang.String getRefererElement(org.apache.http.HttpMessage message)

    - #### getUserAgentElement

          public static java.lang.String getUserAgentElement(org.apache.http.HttpMessage message)

    - #### getAcceptElement

          public static java.lang.String getAcceptElement(org.apache.http.HttpMessage message)

    - #### getAcceptLanguageElement

          public static java.lang.String getAcceptLanguageElement(org.apache.http.HttpMessage message)

    - #### getAcceptEncodingElement

          public static java.lang.String getAcceptEncodingElement(org.apache.http.HttpMessage message)

    - #### getAcceptCharSetElement

          public static java.lang.String getAcceptCharSetElement(org.apache.http.HttpMessage message)

    - #### getConnectionElement

          public static java.lang.String getConnectionElement(org.apache.http.HttpMessage message)

    - #### getContentTypeElement

          public static java.lang.String getContentTypeElement(org.apache.http.HttpMessage message)

    - #### getKeepAliveElement

          public static java.lang.String getKeepAliveElement(org.apache.http.HttpMessage message)

    - #### getTransferEncodingElement

          public static java.lang.String getTransferEncodingElement(org.apache.http.HttpMessage message)

    - #### getContentEncodingElement

          public static java.lang.String getContentEncodingElement(org.apache.http.HttpMessage message)

    - #### getVaryElement

          public static java.lang.String getVaryElement(org.apache.http.HttpMessage message)

    - #### getServerElement

          public static java.lang.String getServerElement(org.apache.http.HttpMessage message)

    - #### getRemoteAddr

          public static java.lang.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` - - HttpRequestWrapper
        `response` - - HttpResponseWrapper

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.