/** * @return the HeaderResponseContainerFilteringHeaderResponse being used in this RequestCycle */ public static HeaderResponseContainerFilteringHeaderResponse get() { RequestCycle requestCycle = RequestCycle.get(); if (requestCycle == null) { throw new IllegalStateException( "you can only get the HeaderResponseContainerFilteringHeaderResponse when there is a RequestCycle present"); } HeaderResponseContainerFilteringHeaderResponse response = requestCycle.getMetaData(RESPONSE_KEY); if (response == null) { throw new IllegalStateException( "no HeaderResponseContainerFilteringHeaderResponse is present in the request cycle. This may mean that you have not decorated the header response with a HeaderResponseContainerFilteringHeaderResponse. Simply calling the HeaderResponseContainerFilteringHeaderResponse constructor sets itself on the request cycle"); } return response; }
RequestData getCurrentRequest() { RequestCycle requestCycle = RequestCycle.get(); RequestData rd = requestCycle.getMetaData(REQUEST_DATA); if (rd == null) { rd = new RequestData(); requestCycle.setMetaData(REQUEST_DATA, rd); int activeCount = active.incrementAndGet(); if (activeCount > peakActive.get()) { peakActive.set(activeCount); } } return rd; }
/** * @param pageMapName * @return used pages map */ public static IntHashMap<Page> getUsedPages(String pageMapName) { Map<String, IntHashMap<Page>> usedPages = RequestCycle.get().getMetaData(USED_PAGES); if (usedPages == null) { usedPages = new HashMap<String, IntHashMap<Page>>(); RequestCycle.get().setMetaData(USED_PAGES, usedPages); } IntHashMap<Page> intHashMap = usedPages.get(pageMapName); if (intHashMap == null) { intHashMap = new IntHashMap<Page>(); usedPages.put(pageMapName, intHashMap); } return intHashMap; }
/** * Called for every component when the page is getting to be rendered. it will call * onBeforeRender for this component and all the child components */ public final void beforeRender() { if (!(this instanceof IFeedback)) { internalBeforeRender(); } else { // this component is a feedback. Feedback must be initialized last, so that // they can collect messages from other components List feedbacks = (List)getRequestCycle().getMetaData(FEEDBACK_LIST); if (feedbacks == null) { feedbacks = new ArrayList(); getRequestCycle().setMetaData(FEEDBACK_LIST, (Serializable)feedbacks); } feedbacks.add(this); } }
List<Component> feedbacks = getRequestCycle().getMetaData(FEEDBACK_LIST); if (feedbacks == null)
/** * Prepares the component and it's children for rendering. On whole page render this method must * be called on the page. On AJAX request, this method must be called on updated component. */ public void prepareForRender() { beforeRender(); List feedbacks = (List)getRequestCycle().getMetaData(FEEDBACK_LIST); if (feedbacks != null) { for (Iterator i = feedbacks.iterator(); i.hasNext();) { Component feedback = (Component)i.next(); feedback.internalBeforeRender(); } } getRequestCycle().setMetaData(FEEDBACK_LIST, null); markRendering(); // check authorization // first the component itself // (after attach as otherwise list views etc wont work) setRenderAllowed(); }
List<Component> feedbacks = getRequestCycle().getMetaData(FEEDBACK_LIST); if (feedbacks != null)
RequestData rd = RequestCycle.get().getMetaData(REQUEST_DATA); if (rd != null)