/** * @param redirect * True if the response should be redirected to * @see RequestCycle#setRedirect(boolean) */ public final void setRedirect(final boolean redirect) { getRequestCycle().setRedirect(redirect); }
private void enforceRedirect() { final RequestCycle cycle = RequestCycle.get(); if (cycle == null) { throw new IllegalStateException("no current request cycle available"); } cycle.setRedirect(true); } }
/** * @param redirect * True if the response should be redirected to * @see RequestCycle#setRedirect(boolean) */ public final void setRedirect(final boolean redirect) { getRequestCycle().setRedirect(redirect); }
/** * Releases the current thread local related resources. The thread-local of this request cycle * is reset. If we are in a 'redirect' state, we do not want to lose our messages as - e.g. when * handling a form - there's a fat chance we are coming back for the rendering of it. */ private final void threadDetach() { // Detach from session if (sessionExists()) { try { getSession().detach(); } catch (RuntimeException re) { log.error("there was an error detaching the session", re); } session = null; } if (isRedirect()) { // Since we are explicitly redirecting to a page already, we do not // want a second redirect to occur automatically setRedirect(false); } // Clear ThreadLocal reference; makes sense as this object should not be // reused current.set(previousOne); }
/** * Releases the current thread local related resources. The threadlocal of this request cycle is * reset. If we are in a 'redirect' state, we do not want to lose our messages as - e.g. when * handling a form - there's a fat chance we are coming back for the rendering of it. */ private final void threadDetach() { // Detach from session if (sessionExists()) { try { getSession().detach(); } catch (RuntimeException re) { log.error("there was an error detaching the session", re); } } if (isRedirect()) { // Since we are explicitly redirecting to a page already, we do not // want a second redirect to occur automatically setRedirect(false); } // Clear ThreadLocal reference; makes sense as this object should not be // reused current.set(null); }
public SignOutPage(final PageParameters params) { PARAM_REQ.Object.requireNotNull(params, "The page parameters parameter must not be null."); final String page = params.getString(REDIRECTPAGE_PARAM); Class<? extends Page> pageClass; if (page != null && !StringUtils.isBlank(page)) { LOGGER.debug("Redirect page not blank: {}", page); try { pageClass = (Class<? extends Page>) Class.forName(page); } catch (ClassNotFoundException ex) { LOGGER.debug("Class not found for redirect page: {}", page); pageClass = getApplication().getHomePage(); } } else { LOGGER.debug("No redirect page, redirecting to application home page."); pageClass = getApplication().getHomePage(); } setStatelessHint(true); getSession().invalidateNow(); getRequestCycle().setRedirect(true); setResponsePage(pageClass); } }
/** * Common functionality to be called by processEvents() * * @param requestCycle * The request cycle */ protected void onProcessEvents(final RequestCycle requestCycle) { getPage().startComponentRender(getTarget()); final Application application = requestCycle.getApplication(); // and see if we have to redirect the render part by default IRequestCycleSettings.RenderStrategy strategy = application.getRequestCycleSettings() .getRenderStrategy(); boolean issueRedirect = (strategy == IRequestCycleSettings.REDIRECT_TO_RENDER || strategy == IRequestCycleSettings.REDIRECT_TO_BUFFER); requestCycle.setRedirect(issueRedirect); } }
/** * Common functionality to be called by processEvents() * * @param requestCycle * The request cycle */ protected void onProcessEvents(final RequestCycle requestCycle) { getPage().startComponentRender(getTarget()); final Application application = requestCycle.getApplication(); // and see if we have to redirect the render part by default IRequestCycleSettings.RenderStrategy strategy = application.getRequestCycleSettings() .getRenderStrategy(); boolean issueRedirect = (strategy == IRequestCycleSettings.REDIRECT_TO_RENDER || strategy == IRequestCycleSettings.REDIRECT_TO_BUFFER); requestCycle.setRedirect(issueRedirect); } }
private void setUpRedirect(final RequestCycle cycle) { Session session = Session.get(); if (session.isTemporary()) { session.bind(); } // The intercept continuation URL should be saved exactly as the // original request specified. // Only if it is an ajax request just redirect to the page where the request is from. if (cycle.getRequest() instanceof WebRequest && ((WebRequest)cycle.getRequest()).isAjax()) { interceptContinuationURL = cycle.urlFor(cycle.getRequest().getPage()).toString(); } else { interceptContinuationURL = "/" + cycle.getRequest().getURL(); } // Page map is dirty dirty(); // Redirect to the page cycle.setRedirect(true); }
private void setUpRedirect(final RequestCycle cycle) { Session session = Session.get(); if (session.isTemporary()) { session.bind(); } // The intercept continuation URL should be saved exactly as the // original request specified. // Only if it is an ajax request just redirect to the page where the request is from. if (cycle.getRequest() instanceof WebRequest && ((WebRequest)cycle.getRequest()).isAjax()) { interceptContinuationURL = cycle.urlFor(cycle.getRequest().getPage()).toString(); } else { // wicket-2061: getURL() returns a properly <b>decoded</b> URL. But we need is a // properly <b>encoded</b> URL. interceptContinuationURL = "/" + cycle.getRequest().getURL(); interceptContinuationURL = WicketURLEncoder.FULL_PATH_INSTANCE.encode(interceptContinuationURL); } // Page map is dirty dirty(); // Redirect to the page cycle.setRedirect(true); }
.getPageExpiredErrorPage(); boolean mounted = isPageMounted(pageExpiredErrorPageClass); RequestCycle.get().setRedirect(mounted); throw new RestartResponseException(pageExpiredErrorPageClass); requestCycle.setRedirect(false); requestCycle.setRedirect(false); ((WebResponse)requestCycle.getResponse()).getHttpServletResponse().setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
requestCycle.setRedirect(true);
.getPageExpiredErrorPage(); boolean mounted = isPageMounted(pageExpiredErrorPageClass); RequestCycle.get().setRedirect(mounted); throw new RestartResponseException(pageExpiredErrorPageClass); requestCycle.setRedirect(false);
requestCycle.setRedirect(true);