Class ThreadedHttpRequestHandler

    • Field Detail

      • log

        protected final java.util.logging.Logger log
        Logger for subclasses
    • Constructor Detail

      • ThreadedHttpRequestHandler

        public ThreadedHttpRequestHandler​(java.util.concurrent.Executor executor)
      • ThreadedHttpRequestHandler

        @Inject
        public ThreadedHttpRequestHandler​(java.util.concurrent.Executor executor,
                                          com.yahoo.jdisc.Metric metric)
      • ThreadedHttpRequestHandler

        public ThreadedHttpRequestHandler​(java.util.concurrent.Executor executor,
                                          com.yahoo.jdisc.Metric metric,
                                          boolean allowAsyncResponse)
    • Method Detail

      • handle

        public abstract HttpResponse handle​(HttpRequest request)
        Override this to implement a synchronous style handler.
        Parameters:
        request - incoming HTTP request
        Returns:
        a valid HTTP response for presentation to the user
      • handle

        public HttpResponse handle​(HttpRequest request,
                                   com.yahoo.jdisc.handler.ContentChannel channel)
        Override this rather than handle(request) to be able to write to the channel before returning from this method. This default implementation calls handle(request)
      • handleRequest

        public final void handleRequest​(com.yahoo.jdisc.Request request,
                                        com.yahoo.jdisc.handler.BufferedContentChannel requestContent,
                                        com.yahoo.jdisc.handler.ResponseHandler responseHandler)
        Specified by:
        handleRequest in class ThreadedRequestHandler
      • addDateHeader

        protected void addDateHeader​(HttpResponse httpResponse,
                                     long startTime)
      • createLoggingCompletionHandler

        protected LoggingCompletionHandler createLoggingCompletionHandler​(long startTime,
                                                                          long renderStartTime,
                                                                          HttpResponse response,
                                                                          HttpRequest httpRequest,
                                                                          ContentChannelOutputStream rendererWiring)
        Override this to implement custom access logging.
        Parameters:
        startTime - execution start
        renderStartTime - start of output rendering
        response - the response which the log entry regards
        httpRequest - the incoming HTTP request
        rendererWiring - the stream the rendered response is written to, used for fetching length of rendered response
      • asHttpRequest

        protected com.yahoo.jdisc.http.HttpRequest asHttpRequest​(com.yahoo.jdisc.Request request)