Search in sources :

Example 6 with WebSession

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;
}
Also used : MockWebResponse(org.apache.wicket.mock.MockWebResponse) IApplication(org.apache.openmeetings.IApplication) RequestCycleContext(org.apache.wicket.request.cycle.RequestCycleContext) IWebSession(org.apache.openmeetings.IWebSession) WebSession(org.apache.wicket.protocol.http.WebSession) IWebSession(org.apache.openmeetings.IWebSession) MockHttpServletRequest(org.apache.wicket.protocol.http.mock.MockHttpServletRequest) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) MockHttpSession(org.apache.wicket.protocol.http.mock.MockHttpSession) ServletWebRequest(org.apache.wicket.protocol.http.servlet.ServletWebRequest) IApplication(org.apache.openmeetings.IApplication) Application(org.apache.wicket.Application) WebApplication(org.apache.wicket.protocol.http.WebApplication)

Aggregations

WebSession (org.apache.wicket.protocol.http.WebSession)6 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)3 ClientProperties (org.apache.wicket.protocol.http.ClientProperties)2 WebClientInfo (org.apache.wicket.protocol.http.request.WebClientInfo)2 Before (org.junit.Before)2 Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 Provider (com.google.inject.Provider)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1 Map (java.util.Map)1 IApplication (org.apache.openmeetings.IApplication)1 IWebSession (org.apache.openmeetings.IWebSession)1 Application (org.apache.wicket.Application)1 Session (org.apache.wicket.Session)1 IAuthorizationStrategy (org.apache.wicket.authorization.IAuthorizationStrategy)1 MockApplication (org.apache.wicket.mock.MockApplication)1 MockWebRequest (org.apache.wicket.mock.MockWebRequest)1 MockWebResponse (org.apache.wicket.mock.MockWebResponse)1 WebApplication (org.apache.wicket.protocol.http.WebApplication)1