private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } clearFlash(context); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
/** * Add view state. * * @param flow the flow * @param id the id * @param expression the expression * @return the view state */ protected ViewState createViewState(final Flow flow, final String id, final Expression expression) { try { final ViewFactory viewFactory = this.flowBuilderServices.getViewFactoryCreator().createViewFactory( expression, this.flowBuilderServices.getExpressionParser(), this.flowBuilderServices.getConversionService(), null, this.flowBuilderServices.getValidator(), this.flowBuilderServices.getValidationHintResolver()); final ViewState viewState = new ViewState(flow, id, viewFactory); logger.debug("Added view state {}", viewState.getId()); return viewState; } catch (final Exception e) { logger.error(e.getMessage(), e); } return null; }
@Override public ViewState createViewState(final Flow flow, final String id, final Expression expression, final BinderConfiguration binder) { try { if (containsFlowState(flow, id)) { LOGGER.trace("Flow [{}] already contains a definition for state id [{}]", flow.getId(), id); return getTransitionableState(flow, id, ViewState.class); } val viewFactory = this.flowBuilderServices.getViewFactoryCreator() .createViewFactory(expression, this.flowBuilderServices.getExpressionParser(), this.flowBuilderServices.getConversionService(), binder, this.flowBuilderServices.getValidator(), this.flowBuilderServices.getValidationHintResolver()); val viewState = new ViewState(flow, id, viewFactory); LOGGER.trace("Added view state [{}]", viewState.getId()); return viewState; } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } clearFlash(context); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } context.getFlashScope().clear(); context.getMessageContext().clearMessages(); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
createTransitionForState(sendUsernameInst, CasWebflowConstants.TRANSITION_ID_ERROR, usernameInfo.getId()); createViewState(flow, CasWebflowConstants.VIEW_ID_SENT_FORGOT_USERNAME_ACCT_INFO, CasWebflowConstants.VIEW_ID_SENT_FORGOT_USERNAME_ACCT_INFO); createTransitionForState(sendInst, CasWebflowConstants.TRANSITION_ID_ERROR, accountInfo.getId()); createViewState(flow, CasWebflowConstants.VIEW_ID_SENT_RESET_PASSWORD_ACCT_INFO, CasWebflowConstants.VIEW_ID_SENT_RESET_PASSWORD_ACCT_INFO);
public void testResumeFlowExecutionException() { Flow flow = new Flow("flow"); ViewState state = new ViewState(flow, "view", new StubViewFactory()) { public void resume(RequestControlContext context) { throw new FlowExecutionException("flow", "view", "oops"); } }; MockFlowExecutionListener mockListener = new MockFlowExecutionListener(); FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener }; FlowExecutionImpl execution = new FlowExecutionImpl(flow); execution.setListeners(listeners); execution.setKeyFactory(new MockFlowExecutionKeyFactory()); MockExternalContext context = new MockExternalContext(); execution.start(null, context); context = new MockExternalContext(); try { execution.resume(context); } catch (FlowExecutionException e) { assertEquals(flow.getId(), e.getFlowId()); assertEquals(state.getId(), e.getStateId()); assertEquals(1, mockListener.getResumingCount()); assertEquals(2, mockListener.getPausedCount()); } }
public void testResumeException() { Flow flow = new Flow("flow"); ViewState state = new ViewState(flow, "view", new StubViewFactory()) { public void resume(RequestControlContext context) { throw new IllegalStateException("Oops"); } }; MockFlowExecutionListener mockListener = new MockFlowExecutionListener(); FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener }; FlowExecutionImpl execution = new FlowExecutionImpl(flow); execution.setListeners(listeners); execution.setKeyFactory(new MockFlowExecutionKeyFactory()); MockExternalContext context = new MockExternalContext(); execution.start(null, context); context = new MockExternalContext(); try { execution.resume(context); } catch (FlowExecutionException e) { assertEquals(flow.getId(), e.getFlowId()); assertEquals(state.getId(), e.getStateId()); assertEquals(1, mockListener.getResumingCount()); assertEquals(2, mockListener.getPausedCount()); } }