public final RequestCycle createRequestCycle(final Request request, final Response response)
{
RequestCycleContext context = new RequestCycleContext(request, response,
getRootRequestMapper(), getExceptionMapperProvider().get());
RequestCycle requestCycle = getRequestCycleProvider().get(context);
requestCycle.getListeners().add(requestCycleListeners);
requestCycle.getListeners().add(new AbstractRequestCycleListener()
{
@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;