All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.crashnote.servlet.report.ServletReporter2.jav Maven / Gradle / Ivy

///**
// * Copyright (C) 2011 - 101loops.com 
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// *         http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package com.crashnote.servlet.report;
//
//import com.crashnote.logger.report.LoggerReporter;
//import com.crashnote.servlet.collect.*;
//import com.crashnote.servlet.config.ServletConfig;
//import com.crashnote.servlet.model.CustomServletResponse;
//
//import javax.servlet.ServletRequest;
//import javax.servlet.http.HttpServletRequest;
//
///**
// * Customized implementation of the core {@link com.crashnote.logger.report.LoggerReporter}. Adds servlet-specific functionality.
// */
//public class ServletReporter2
//    extends LoggerReporter {
//
//    private final RequestCollector reqCollector;
//    private final ResponseCollector respCollector;
//    private final SessionCollector sesCollector;
//
//    // SETUP ======================================================================================
//
//    public ServletReporter2(final C config) {
//        super(config);
//        this.reqCollector = new RequestCollector(config);
//        this.sesCollector = new SessionCollector(config);
//        this.respCollector = new ResponseCollector(config);
//    }
//
//    // INTERFACE ==================================================================================
//
//    /**
//     * Before each request, start the internal log session
//     *
//     * @param request  the HTTP request
//     */
//    public void beforeRequest(final ServletRequest request) {
//        startSession();
//    }
//
//    /**
//     * In case of an uncaught exception, process it
//     *
//     * @param request the HTTP request
//     * @param t       the thread where the error occured
//     * @param th      the exception details
//     */
//    public void uncaughtException(final ServletRequest request, final Thread t, final Throwable th) {
//        uncaughtException(t, th);
//    }
//
//    /**
//     * After each request, finish the internal log session
//     *
//     * @param request  the HTTP request
//     * @param response the HTTP response
//     */
//    public void afterRequest(final ServletRequest request, final CustomServletResponse response) {
//        put("req", reqCollector.collect((HttpServletRequest) request));
//        put("resp", respCollector.collect(response));
//        put("session", sesCollector.collect((HttpServletRequest) request));
//
//        endSession();
//    }
//
//    // SHARED =====================================================================================
//
//    /**
//     * Do not flush reports out immediately - wait till the session has finished
//     */
//    @Override
//    protected boolean isAutoFlush() {
//        return false;
//    }
//}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy