use of org.apache.wicket.request.cycle.RequestCycleContext in project wicket by apache.
the class AbstractWebSocketProcessor method createRequestCycle.
private RequestCycle createRequestCycle(WebSocketRequestMapper requestMapper, WebResponse webResponse) {
RequestCycleContext context = new RequestCycleContext(webRequest, webResponse, requestMapper, application.getExceptionMapperProvider().get());
RequestCycle requestCycle = application.getRequestCycleProvider().apply(context);
requestCycle.getListeners().add(application.getRequestCycleListeners());
requestCycle.getListeners().add(new IRequestCycleListener() {
@Override
public void onDetach(final RequestCycle requestCycle) {
if (Session.exists()) {
Session.get().getPageManager().commitRequest();
}
}
});
requestCycle.getUrlRenderer().setBaseUrl(baseUrl);
return requestCycle;
}
use of org.apache.wicket.request.cycle.RequestCycleContext 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;
}
use of org.apache.wicket.request.cycle.RequestCycleContext in project openmeetings by apache.
the class ApplicationHelper method ensureApplication.
public static IApplication ensureApplication(Long langId) {
IApplication a = ensureApplication();
if (ThreadContext.getRequestCycle() == null) {
ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application) a, new MockHttpSession(a.getServletContext()), a.getServletContext()), "");
RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get());
ThreadContext.setRequestCycle(new RequestCycle(rctx));
}
if (ThreadContext.getSession() == null) {
WebSession s = WebSession.get();
if (langId > 0) {
((IWebSession) s).setLanguage(langId);
}
}
return a;
}
Aggregations