Search in sources :

Example 6 with IRequestLogger

use of org.apache.wicket.protocol.http.IRequestLogger in project wicket by apache.

the class Application method createRequestCycle.

/**
 * @param request
 * @param response
 * @return request cycle
 */
public final RequestCycle createRequestCycle(final Request request, final Response response) {
    RequestCycleContext context = new RequestCycleContext(request, response, getRootRequestMapper(), getExceptionMapperProvider().get());
    RequestCycle requestCycle = getRequestCycleProvider().apply(context);
    requestCycle.getListeners().add(requestCycleListeners);
    requestCycle.getListeners().add(new IRequestCycleListener() {

        @Override
        public void onDetach(final RequestCycle requestCycle) {
            if (Session.exists()) {
                Session.get().getPageManager().commitRequest();
            }
            if (Application.exists()) {
                IRequestLogger requestLogger = Application.get().getRequestLogger();
                if (requestLogger != null) {
                    requestLogger.requestTime((System.currentTimeMillis() - requestCycle.getStartTime()));
                }
            }
        }
    });
    return requestCycle;
}
Also used : IRequestLogger(org.apache.wicket.protocol.http.IRequestLogger) IRequestCycleListener(org.apache.wicket.request.cycle.IRequestCycleListener) RequestCycleContext(org.apache.wicket.request.cycle.RequestCycleContext) RequestCycle(org.apache.wicket.request.cycle.RequestCycle)

Aggregations

IRequestLogger (org.apache.wicket.protocol.http.IRequestLogger)6 HttpSession (javax.servlet.http.HttpSession)3 RequestLogger (org.apache.wicket.protocol.http.RequestLogger)2 WebApplication (org.apache.wicket.protocol.http.WebApplication)2 IRequestCycleListener (org.apache.wicket.request.cycle.IRequestCycleListener)1 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)1 RequestCycleContext (org.apache.wicket.request.cycle.RequestCycleContext)1