List of usage examples for org.apache.wicket.core.request.handler RenderPageRequestHandler getPage
@Override
public IRequestablePage getPage()
From source file:org.apache.isis.viewer.wicket.viewer.integration.wicket.WebRequestCycleForIsis.java
License:Apache License
/** * Is called prior to {@link #onEndRequest(RequestCycle)}, and offers the opportunity to * throw an exception.// w ww . ja v a 2s . c o m */ @Override public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler) { if (LOG.isDebugEnabled()) { LOG.debug("onRequestHandlerExecuted: handler: " + handler); } final IsisSession session = getIsisContext().getSessionInstance(); if (session != null) { try { // will commit (or abort) the transaction; // an abort will cause the exception to be thrown. getTransactionManager().endTransaction(); } catch (Exception ex) { // will redirect to error page after this, // so make sure there is a new transaction ready to go. if (getTransactionManager().getTransaction().getState().isComplete()) { getTransactionManager().startTransaction(); } if (handler instanceof RenderPageRequestHandler) { RenderPageRequestHandler requestHandler = (RenderPageRequestHandler) handler; if (requestHandler.getPage() instanceof ErrorPage) { // do nothing return; } } // shouldn't return null given that we're in a session ... PageProvider errorPageProvider = errorPageProviderFor(ex); throw new RestartResponseException(errorPageProvider, RedirectPolicy.ALWAYS_REDIRECT); } } }