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

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

Introduction

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

Prototype

public void setResponsePage(Class<? extends IRequestablePage> pageClass) 

Source Link

Document

Convenience method for setting next page to be rendered.

Usage

From source file:at.molindo.wicketutils.utils.PageSpec.java

License:Apache License

public static PageSpec get(final Page page) {

    return new PageSpec(false) {

        @Override/*w  w  w .  ja  v a  2  s.c  o  m*/
        protected void setResponsePage(RequestCycle rc) {
            rc.setResponsePage(page);
        }

    };
}

From source file:com.cubeia.backoffice.web.BackofficeRequestCycleListener.java

License:Open Source License

@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
    // search for errors we want to intercept
    for (Throwable t : flattenCauses(ex)) {
        if (t instanceof HttpException) {
            cycle.setResponsePage(new RemoteServiceError(t.getMessage()));
        }//from  ww w  .  ja v a  2s. co  m
    }

    return super.onException(cycle, ex);
}

From source file:org.apache.isis.viewer.wicket.ui.components.property.PropertyFormExecutorStrategy.java

License:Apache License

public void redirectTo(final ObjectAdapter resultAdapter, final AjaxRequestTarget target) {
    // disabling concurrency checking after the layout XML (grid) feature
    // was throwing an exception when rebuild grid after invoking edit prompt.
    // not certain why that would be the case, but (following similar code for action prompt)
    // think it should be safe to simply disable while recreating the page to re-render back to user.
    final EntityPage entityPage = AdapterManager.ConcurrencyChecking
            .executeWithConcurrencyCheckingDisabled(new Callable<EntityPage>() {
                @Override//  w w  w.j av  a2  s.co m
                public EntityPage call() throws Exception {
                    return new EntityPage(resultAdapter, null);
                }
            });

    final RequestCycle requestCycle = RequestCycle.get();
    requestCycle.setResponsePage(entityPage);
}

From source file:org.apache.isis.viewer.wicket.ui.panels.FormExecutorDefault.java

License:Apache License

private void forwardOnConcurrencyException(final ObjectAdapter targetAdapter, final ConcurrencyException ex) {

    // this will not preserve the URL (because pageParameters are not copied over)
    // but trying to preserve them seems to cause the 302 redirect to be swallowed somehow
    final EntityPage entityPage =

            // disabling concurrency checking after the layout XML (grid) feature
            // was throwing an exception when rebuild grid after invoking action
            // not certain why that would be the case, but think it should be
            // safe to simply disable while recreating the page to re-render back to user.
            AdapterManager.ConcurrencyChecking
                    .executeWithConcurrencyCheckingDisabled(new Callable<EntityPage>() {
                        @Override
                        public EntityPage call() throws Exception {
                            return new EntityPage(targetAdapter, ex);
                        }/*from   ww  w.  j a v  a 2s  .  c  o m*/
                    });

    // force any changes in state etc to happen now prior to the redirect;
    // in the case of an object being returned, this should cause our page mementos
    // (eg EntityModel) to hold the correct state.  I hope.
    getIsisSessionFactory().getCurrentSession().getPersistenceSession().getTransactionManager()
            .flushTransaction();

    // "redirect-after-post"
    final RequestCycle requestCycle = RequestCycle.get();
    requestCycle.setResponsePage(entityPage);
}