private void endRequest(RequestResponse togo) { if (!singleshot) { ConcreteWBL saved = new ConcreteWBL(); for (Iterator names = togo.requestContext.iterator(); names.hasNext();) { String name = (String) names.next(); saved.set(name, togo.requestContext.locateBean(name)); } // this will trash all request beans rsacbl.endRequest(); togo.requestContext = saved; } }
public Iterator iterator() { if (seed instanceof IterableBeanLocator) { return ((IterableBeanLocator) seed).iterator(); } else throw new UniversalRuntimeException("Wrapped bean of " + seed.getClass() + " is not iterable"); } };
protected TargettedMessageList fetchMessages(RequestResponse response) { return (TargettedMessageList) response.requestContext.locateBean("targettedMessageList"); }
/** Assert whether the action cycle in question has completed without error * @param response The action cycle to be tested * @param error <code>true</code> if it is to be asserted there was an error, * or <code>false</code> if it is to be asserted there was none. */ protected void assertActionError(ActionResponse response, boolean error) { TargettedMessageList tml = (TargettedMessageList) response.requestContext.locateBean("targettedMessageList"); Assert.assertTrue(errorString(error), !tml.isError() ^ error); }
public int preserveImmediate(BeanLocator source, StringList beannames, String tokenid) { HashMap beans = new HashMap(); for (int i = 0; i < beannames.size(); ++i) { String beanname = beannames.stringAt(i); Object bean = alterer.getBeanValue(beanname, source, null); // This branch generally useful for entity bean locators if (bean instanceof IterableBeanLocator) { IterableBeanLocator iterablebean = (IterableBeanLocator) bean; for (Iterator beanit = iterablebean.iterator(); beanit.hasNext(); ) { String subbeanname = (String) beanit.next(); Object subbean = iterablebean.locateBean(subbeanname); String fullpath = PathUtil.buildPath(beanname, subbeanname); beans.put(fullpath, subbean); } } if (bean != null) { beans.put(beanname, bean); Logger.log.info("BeanCopy preserved to path " + beanname + ": " + bean); } } String token = basekey + tokenid; holder.putTokenState(token, beans); Logger.log.info("BeanCopy saved " + beans.size() + " beans to token " + token); return beans.size(); }
/** Assert whether the render cycle in question has completed without error * @param response The render cycle to be tested * @param error <code>true</code> if it is to be asserted there was an error, * or <code>false</code> if it is to be asserted there was none. */ protected void assertRenderError(RenderResponse response, boolean error) { boolean wasError = false; if (response.redirect instanceof ViewParameters) { ViewParameters redirect = (ViewParameters) response.redirect; wasError = redirect.errorredirect != null; } if (response.markup != null) { if (response.markup.indexOf(DefaultFatalErrorHandler.ERROR_STRING) != -1) { wasError = true; } } MockHttpServletResponse mockresponse = (MockHttpServletResponse) response.requestContext.locateBean("httpServletResponse"); if (mockresponse != null) { int status = mockresponse.getStatus(); if (status >= 400 && status < 600) { wasError = true; } } Assert.assertFalse(errorString(error), wasError ^ error); }
for (Iterator childit = children.iterator(); childit.hasNext();) { UIComponent nested = (UIComponent) children.locateBean((String) childit .next()); registerComponent(toprocess, nested);
ViewRender viewRender = (ViewRender) togo.requestContext.locateBean("viewRender"); if (viewRender != null && viewRender.getView() != null) { togo.viewWrapper = new ViewWrapper(viewRender.getView().viewroot, smc);