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

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

Introduction

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

Prototype

public IRequestHandler getRequestHandlerScheduledAfterCurrent() 

Source Link

Usage

From source file:com.evolveum.midpoint.web.security.LoggingRequestCycleListener.java

License:Apache License

@Override
public void onEndRequest(RequestCycle cycle) {
    if (REQUEST_LOGGER.isTraceEnabled()) {
        REQUEST_LOGGER.trace("REQUEST CYCLE: End request: '{}', next handler: {}",
                cycle.getRequest().getOriginalUrl(),
                WebComponentUtil.debugHandler(cycle.getRequestHandlerScheduledAfterCurrent()));
    }/*from w ww .j a  v a  2 s.c om*/
    super.onBeginRequest(cycle);
}

From source file:com.evolveum.midpoint.web.security.LoggingRequestCycleListener.java

License:Apache License

@Override
public void onDetach(RequestCycle cycle) {
    if (REQUEST_LOGGER.isTraceEnabled()) {
        REQUEST_LOGGER.trace("REQUEST CYCLE: Detach, request: '{}', next handler: {}",
                cycle.getRequest().getOriginalUrl(),
                WebComponentUtil.debugHandler(cycle.getRequestHandlerScheduledAfterCurrent()));

    }/*www  .  ja  va  2s .co  m*/
    super.onBeginRequest(cycle);
}

From source file:gr.interamerican.wicket.bo2.callbacks.TestList2CsvAction.java

License:Open Source License

/**
 * Unit test for create(clazz)./*from ww  w  . j a v  a  2  s . c  o  m*/
 */
@SuppressWarnings({ "nls", "rawtypes", "unchecked" })
@Test
public void testAction() {
    RequestCycle rc = RequestCycle.get();
    Bo2WicketRequestCycle.beginRequest(rc);

    BeanWith3Fields[] beans = { new BeanWith3Fields("one", 1, 1.0), new BeanWith3Fields("two", 2, 2.0) };
    List<BeanWith3Fields> list = Arrays.asList(beans);
    String[] properties = { "field1", "field2" };
    String[] labels = { "Field 1", "Field 2" };
    String filename = "TestCsvFile.csv";

    List2CsvActionClient client = Mockito.mock(List2CsvActionClient.class);
    Mockito.when(client.getList()).thenReturn((List) list);
    Mockito.when(client.getPropertiesToExport()).thenReturn(properties);
    Mockito.when(client.getColumnLabels()).thenReturn(labels);
    Mockito.when(client.getFileName()).thenReturn(filename);
    Mockito.when(client.getDownloadedFileName()).thenReturn(filename);

    List2CsvAction action = new List2CsvAction(client);

    action.execute();
    IRequestHandler target = rc.getRequestHandlerScheduledAfterCurrent();
    Assert.assertTrue(target instanceof ResourceStreamRequestHandler);
    ResourceStreamRequestHandler rt = (ResourceStreamRequestHandler) target;
    Assert.assertEquals(rt.getFileName(), client.getFileName());
    Bo2WicketRequestCycle.endRequest(rc);
}

From source file:name.martingeisse.admin.application.wicket.ExceptionMapper.java

License:Open Source License

/**
 * /*from   w w  w. j  a v  a 2  s.  c  om*/
 */
@SuppressWarnings("unused")
private Page extractCurrentPage() {
    final RequestCycle requestCycle = RequestCycle.get();
    IRequestHandler handler = requestCycle.getActiveRequestHandler();
    if (handler == null) {
        handler = requestCycle.getRequestHandlerScheduledAfterCurrent();
    }
    if (handler instanceof IPageRequestHandler) {
        final IPageRequestHandler pageRequestHandler = (IPageRequestHandler) handler;
        return (Page) pageRequestHandler.getPage();
    }
    return null;
}

From source file:name.martingeisse.trading_game.gui.util.AjaxRequestUtil.java

License:Open Source License

/**
 * Obtains the {@link AjaxRequestTarget} for the current request. Returns
 * null for non-AJAX requests./*from  w  w  w  .  j a  v a2  s.  c om*/
 *
 * @return the ART
 */
public static AjaxRequestTarget getAjaxRequestTarget() {
    RequestCycle requestCycle = RequestCycle.get();
    IRequestHandler scheduledHandler = requestCycle.getRequestHandlerScheduledAfterCurrent();
    if (scheduledHandler instanceof AjaxRequestTarget) {
        return (AjaxRequestTarget) scheduledHandler;
    }
    IRequestHandler currentHandler = requestCycle.getActiveRequestHandler();
    if (currentHandler instanceof AjaxRequestTarget) {
        return (AjaxRequestTarget) currentHandler;
    }
    return null;
}

From source file:name.martingeisse.webide.util.NewWindowInterceptBehavior.java

License:Open Source License

@Override
public void onRequest() {
    final RequestCycle requestCycle = RequestCycle.get();
    final StringValue uuidParam = requestCycle.getRequest().getRequestParameters()
            .getParameterValue(PARAM_WINDOW_NAME);
    if (!windowName.equals(uuidParam.toString())) {
        IRequestHandler scheduledHandler1 = requestCycle.getRequestHandlerScheduledAfterCurrent();
        onNewWindow();/*from   w ww .ja v  a  2s . co  m*/
        IRequestHandler scheduledHandler2 = requestCycle.getRequestHandlerScheduledAfterCurrent();
        if (scheduledHandler1 == scheduledHandler2) {
            throw new RuntimeException(
                    "NewWindowInterceptBehavior.onNewWindow() did not schedule a new request handler -- "
                            + "this would cause an infinite loop, so we break here");
        }
    }
}

From source file:org.dcm4chee.wizard.WizardApplication.java

License:LGPL

@Override
protected void init() {
    super.init();
    getExceptionSettings().setAjaxErrorHandlingStrategy(AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);
    getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        public IRequestHandler onException(RequestCycle cycle, Exception e) {
            //                while (e.getCause() != null)
            //                    e = (Exception) e.getCause();
            //                if (!(e instanceof PageExpiredException))
            //                    cycle.setResponsePage(new InternalErrorPage(e, null));
            log.error("Unexpected exception in the wizard application: ", e);
            return cycle.getRequestHandlerScheduledAfterCurrent();
        }/*from   w  w w. j a  v  a2  s  . c om*/
    });
    getDicomConfigurationManager();
    getTransferCapabilityProfiles();
}

From source file:org.geoserver.web.admin.AbstractAdminPrivilegeTest.java

License:Open Source License

public void testSqlViewNewPageAsWorkspaceAdmin() throws Exception {
    loginAsCite();/*from   w w  w  .j  av a  2s .  c  o m*/

    PageParameters pp = new PageParameters();
    pp.add(SQLViewNewPage.WORKSPACE, "cite");

    //not a jdbc datastore obviously but we don't need one to simply test that the 
    // page will render with worksapce admin privilieges
    pp.add(SQLViewNewPage.DATASTORE, "cite");

    new SQLViewNewPage(pp);

    RequestCycle cycle = RequestCycle.get();
    RenderPageRequestHandler handler = (RenderPageRequestHandler) cycle
            .getRequestHandlerScheduledAfterCurrent();
    assertFalse(UnauthorizedPage.class.equals(handler.getPageClass()));
}

From source file:org.geoserver.web.admin.AbstractAdminPrivilegeTest.java

License:Open Source License

public void testCreateNewFeatureTypePageAsWorkspaceAdmin() throws Exception {
    loginAsCite();/*  w  w w  .  ja v a2s. c  o  m*/

    PageParameters pp = new PageParameters();
    pp.add(NewFeatureTypePage.WORKSPACE, "cite");

    //not a jdbc datastore obviously but we don't need one to simply test that the 
    // page will render with worksapce admin privilieges
    pp.add(NewFeatureTypePage.DATASTORE, "cite");

    new NewFeatureTypePage(pp);

    RequestCycle cycle = RequestCycle.get();
    RenderPageRequestHandler handler = (RenderPageRequestHandler) cycle
            .getRequestHandlerScheduledAfterCurrent();
    assertFalse(UnauthorizedPage.class.equals(handler.getPageClass()));
}