use of org.apache.wicket.protocol.http.WebSession 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