Class AccessLoggingRequestHandler

java.lang.Object
com.yahoo.jdisc.AbstractResource
com.yahoo.jdisc.handler.AbstractRequestHandler
com.yahoo.jdisc.http.server.jetty.AccessLoggingRequestHandler
All Implemented Interfaces:
com.yahoo.jdisc.handler.DelegatedRequestHandler, com.yahoo.jdisc.handler.RequestHandler, com.yahoo.jdisc.SharedResource

public class AccessLoggingRequestHandler extends com.yahoo.jdisc.handler.AbstractRequestHandler implements com.yahoo.jdisc.handler.DelegatedRequestHandler
A wrapper RequestHandler that enables access logging. By wrapping the request handler, we are able to wrap the response handler as well. Hence, we can populate the access log entry with information from both the request and the response. This wrapper also adds the access log entry to the request context, so that request handlers may add information to it. Does not otherwise interfere with the request processing of the delegate request handler.
Author:
bakksjo
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.yahoo.jdisc.SharedResource

    com.yahoo.jdisc.SharedResource.Debug
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from interface com.yahoo.jdisc.SharedResource

    DEBUG, SYSTEM_PROPERTY_NAME_DEBUG
  • Constructor Summary

    Constructors
    Constructor
    Description
    AccessLoggingRequestHandler(com.yahoo.jdisc.handler.RequestHandler delegateRequestHandler, AccessLogEntry accessLogEntry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    getAccessLogEntry(Map<String,Object> requestContextMap)
     
    com.yahoo.jdisc.handler.RequestHandler
     
    com.yahoo.jdisc.handler.ContentChannel
    handleRequest(com.yahoo.jdisc.Request request, com.yahoo.jdisc.handler.ResponseHandler handler)
     

    Methods inherited from class com.yahoo.jdisc.handler.AbstractRequestHandler

    handleTimeout

    Methods inherited from class com.yahoo.jdisc.AbstractResource

    currentState, destroy, refer, refer, release, retainCount

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface com.yahoo.jdisc.handler.DelegatedRequestHandler

    getDelegateRecursive

    Methods inherited from interface com.yahoo.jdisc.handler.RequestHandler

    handleTimeout

    Methods inherited from interface com.yahoo.jdisc.SharedResource

    refer, refer, release
  • Field Details

    • CONTEXT_KEY_ACCESS_LOG_ENTRY

      public static final String CONTEXT_KEY_ACCESS_LOG_ENTRY
  • Constructor Details

    • AccessLoggingRequestHandler

      public AccessLoggingRequestHandler(com.yahoo.jdisc.handler.RequestHandler delegateRequestHandler, AccessLogEntry accessLogEntry)
  • Method Details

    • getAccessLogEntry

      public static Optional<AccessLogEntry> getAccessLogEntry(HttpRequest jdiscRequest)
    • getAccessLogEntry

      public static Optional<AccessLogEntry> getAccessLogEntry(Map<String,Object> requestContextMap)
    • handleRequest

      public com.yahoo.jdisc.handler.ContentChannel handleRequest(com.yahoo.jdisc.Request request, com.yahoo.jdisc.handler.ResponseHandler handler)
      Specified by:
      handleRequest in interface com.yahoo.jdisc.handler.RequestHandler
    • getDelegate

      public com.yahoo.jdisc.handler.RequestHandler getDelegate()
      Specified by:
      getDelegate in interface com.yahoo.jdisc.handler.DelegatedRequestHandler