Example usage for org.apache.wicket.request.cycle RequestCycle RequestCycle

List of usage examples for org.apache.wicket.request.cycle RequestCycle RequestCycle

Introduction

In this page you can find the example usage for org.apache.wicket.request.cycle RequestCycle RequestCycle.

Prototype

public RequestCycle(RequestCycleContext context) 

Source Link

Document

Construct.

Usage

From source file:guru.mmp.application.web.WebSphereAbsoluteUrlRequestCycleProvider.java

License:Apache License

/**
 * Returns the request cycle./*from w w w.  j a va2 s.c  o m*/
 *
 * @param context the request cycle context
 *
 * @return the request cycle
 */
@Override
public RequestCycle get(RequestCycleContext context) {
    return new RequestCycle(context) {
        @Override
        protected UrlRenderer newUrlRenderer() {
            return new WebSphereAbsoluteUrlRenderer(getRequest());
        }
    };
}

From source file:org.apache.openmeetings.db.util.ApplicationHelper.java

License:Apache License

public static IApplication ensureApplication(Long langId) {
    IApplication a = null;// ww  w  . j  av a2 s. com
    if (Application.exists()) {
        a = (IApplication) Application.get();
    } else {
        WebApplication app = (WebApplication) Application.get(wicketApplicationName);
        LabelDao.initLanguageMap();
        if (app == null) {
            try {
                app = (WebApplication) LabelDao.getAppClass().newInstance();
            } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
                log.error("Failed to create Application");
                return null;
            }
            app.setServletContext(new MockServletContext(app, null));
            app.setName(wicketApplicationName);
            ServletContext sc = app.getServletContext();
            OMContextListener omcl = new OMContextListener();
            omcl.contextInitialized(new ServletContextEvent(sc));
            XmlWebApplicationContext xmlContext = new XmlWebApplicationContext();
            xmlContext.setConfigLocation("classpath:openmeetings-applicationContext.xml");
            xmlContext.setServletContext(sc);
            xmlContext.refresh();
            sc.setAttribute(ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, xmlContext);
            app.setConfigurationType(RuntimeConfigurationType.DEPLOYMENT);
            ThreadContext.setApplication(app);
            app.initApplication();
        } else {
            ThreadContext.setApplication(app);
        }
        a = (IApplication) Application.get(wicketApplicationName);
    }
    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;
}

From source file:org.yes.cart.web.application.StorefrontApplication.java

License:Apache License

/**
 * {@inheritDoc}
 */
public RequestCycle get(final RequestCycleContext context) {
    return new RequestCycle(context);
}