/** * {@inheritDoc} */ @Override public final void serviceRequest(final Request request) { ArrayList<WComponent> visibles = new ArrayList<>(); collateVisible(this, visibles); if (LOG.isDebugEnabled()) { LOG.debug("Calling handleRequest for " + visibles.size() + " components"); } for (int i = 0; i < visibles.size(); i++) { WComponent next = visibles.get(i); if (LOG.isDebugEnabled()) { LOG.debug("Calling handleRequest on " + next.getId() + " " + next.getClass()); } next.handleRequest(request); } invokeLaters(); }
/** * When the window is targetted, we need to run the "laters". If we don't do this, they will not run because a * targetted request bypasses the root component that would normally have run them. */ @Override protected void invokeLaters() { if (getState() == ACTIVE_STATE && isTargeted()) { UIContextHolder.getCurrent().doInvokeLaters(); } else { super.invokeLaters(); } }
@Test public void testForward() { String testUrl = "www.invalid"; AbstractWComponent comp = new SimpleComponent(); comp.setLocked(true); setActiveContext(createUIContext()); comp.forward(testUrl); try { comp.invokeLaters(); Assert.fail("forward when run should throw a forward exception"); } catch (ForwardException e) { Assert.assertEquals("Incorrect forward URL", testUrl, e.getForwardTo()); } }