/** * Determine the "statelessness" of the page while not changing the cached value. * * @return boolean value */ private boolean peekPageStateless() { Boolean old = stateless; Boolean res = isPageStateless(); stateless = old; return res; }
/** * Determine the "statelessness" of the page while not changing the cached value. * * @return boolean value */ private boolean peekPageStateless() { Boolean old = stateless; Boolean res = isPageStateless(); stateless = old; return res; }
/** * Determine the "statelessness" of the page while not changing the cached value. * * @return boolean value */ private boolean peekPageStateless() { Boolean old = stateless; Boolean res = isPageStateless(); stateless = old; return res; }
public boolean isStateless() { if (node instanceof Page) { return ((Page)node).isPageStateless(); } else if (node instanceof Component) { return ((Component)node).isStateless(); } else { Behavior behavior = (Behavior)node; Component parent = (Component)this.parent.node; return behavior.getStatelessHint(parent); } }
public boolean isStateless() { if (node instanceof Page) { return ((Page)node).isPageStateless(); } else if (node instanceof Component) { return ((Component)node).isStateless(); } else { Behavior behavior = (Behavior)node; Component parent = (Component)this.parent.node; return behavior.getStatelessHint(parent); } }
public void respond(RequestCycle requestCycle) { Page page = getPage(requestCycle); if (page.isPageStateless() == false && redirect) { requestCycle.redirectTo(page); } else { super.respond(requestCycle); } } };
@Test public void checkForStateless() { StatelessWebPage statelessPage = getStatelessWebPage(); if (statelessPage != null) { Page page = (Page)statelessPage; if (!page.isPageStateless()) { //find the reason Component statefulComponent = page.visitChildren(Component.class, new StatelessChecker()); if (statefulComponent != null) { fail("Stateless page contains stateful component [" +statefulComponent.getClass().getName()+" : " + statefulComponent.getMarkupId() +"]"); } } } }
/** * @see org.apache.wicket.request.target.component.BookmarkablePageRequestTarget#respond(org.apache.wicket.RequestCycle) */ @Override public void respond(final RequestCycle requestCycle) { Page page = getPage(requestCycle); if ((page.isPageStateless() == false) && redirect) { requestCycle.redirectTo(page); } else { super.respond(requestCycle); } } }
/** * Returns the HiddenFieldId which will be used as the name and id property of the hiddenfield * that is generated for event dispatches. * * @return The name and id of the hidden field. */ public final String getHiddenFieldId() { String formId; if (!getPage().isPageStateless()) { // only assigned inside statefull pages WICKET-3438 formId = getMarkupId(); } else { formId = Form.getRootFormRelativeId(this).replace(":", "_"); } return getInputNamePrefix() + formId + "_hf_0"; }
protected void onBeforeRender() { super.onBeforeRender(); // If any of the components on page is not stateless, we need to bind the session // before we start rendering components, as then jsessionid won't be appended // for links rendered before first stateful component if (getSession().isTemporary() && !isPageStateless()) { getSession().bind(); } }
public void respond(RequestCycle requestCycle) { Page page = getPage(requestCycle); // if the listener call wanted to redirect // then do that if the page is not stateless. if (requestCycle.isRedirect() && !page.isPageStateless()) { requestCycle.redirectTo(page); } else { // else render the page directly page.renderPage(); } }
@Override public void respond(RequestCycle requestCycle) { Page page = getPage(requestCycle); // if the listener call wanted to redirect // then do that if the page is not stateless. if (requestCycle.isRedirect() && !page.isPageStateless()) { requestCycle.redirectTo(page); } else { // else render the page directly page.renderPage(); } }
/** * Create a suitable request handler depending whether the page is stateless or bookmarkable. */ private IRequestHandler createRequestHandler(PageParameters parameters, Integer id) { Page page = getPage(); PageAndComponentProvider provider = new PageAndComponentProvider(page, this, parameters); if (page.isPageStateless() || (page.isBookmarkable() && page.wasCreatedBookmarkable())) { return new BookmarkableListenerRequestHandler(provider, id); } else { return new ListenerRequestHandler(provider, id); } }
/** * Create a suitable request handler depending whether the page is stateless or bookmarkable. */ private IRequestHandler createRequestHandler(PageParameters parameters, Integer id) { Page page = getPage(); PageAndComponentProvider provider = new PageAndComponentProvider(page, this, parameters); if (page.isPageStateless() || (page.isBookmarkable() && page.wasCreatedBookmarkable())) { return new BookmarkableListenerRequestHandler(provider, id); } else { return new ListenerRequestHandler(provider, id); } }
/** * @see org.apache.wicket.PageMap#put(org.apache.wicket.Page) */ public void put(Page page) { if (!page.isPageStateless()) { Session session = getSession(); String sessionId = session.getId(); if (sessionId != null && !session.isSessionInvalidated()) { // the id could have changed from null during request this.sessionId = sessionId; getStore().storePage(sessionId, page); setLastPage(page); dirty(); } } }
/** * @see org.apache.wicket.PageMap#put(org.apache.wicket.Page) */ @Override public void put(Page page) { if (!page.isPageStateless()) { Session session = getSession(); String sessionId = session.getId(); if (sessionId != null && !session.isSessionInvalidated()) { // the id could have changed from null during request this.sessionId = sessionId; getStore().storePage(sessionId, page); setLastPage(page); dirty(); } } }
if (page.isPageStateless() || (page.isBookmarkable() && page.wasCreatedBookmarkable()))
/** * Simulates processing URL that invokes an {@link IRequestListener} on a component. * * After the listener is invoked the page containing the component will be rendered (with an * optional redirect - depending on {@link RenderStrategy}). * * @param component */ public void executeListener(final Component component) { Args.notNull(component, "component"); // there are two ways to do this. RequestCycle could be forced to call the handler // directly but constructing and parsing the URL increases the chance of triggering bugs Page page = component.getPage(); PageAndComponentProvider pageAndComponentProvider = new PageAndComponentProvider(page, component); IRequestHandler handler = null; if (page.isPageStateless() || (page.isBookmarkable() && page.wasCreatedBookmarkable())) { handler = new BookmarkableListenerRequestHandler(pageAndComponentProvider); } else { handler = new ListenerRequestHandler(pageAndComponentProvider); } Url url = urlFor(handler); request.setUrl(url); // Process the request processRequest(request, null); }