Package org.springframework.springfaces.mvc.render

Examples of org.springframework.springfaces.mvc.render.ViewArtifact


  }

  @Test
  public void shouldClearRenderingEvenOnException() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("theartifact"));
    Map<String, Object> model = new HashMap<String, Object>();
    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    willThrow(new IllegalStateException()).given(lifecycle).render((FacesContext) any());
    this.thrown.expect(IllegalStateException.class);
View Full Code Here


  }

  @Test
  public void shouldSetViewRootIfDoubleRendering() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("theartifact"));
    final Map<String, Object> model = new HashMap<String, Object>();

    Application application = mock(Application.class);
    ViewHandler viewHandler = mock(ViewHandler.class);
    final UIViewRoot newViewRoot = mock(UIViewRoot.class);
    given(this.facesContext.getApplication()).willReturn(application);
    given(application.getViewHandler()).willReturn(viewHandler);
    given(viewHandler.createView(any(FacesContext.class), eq("newartifact"))).willReturn(newViewRoot);

    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    willAnswer(new Answer<Object>() {
      public Object answer(InvocationOnMock invocation) throws Throwable {
        FacesView view2 = mock(FacesView.class);
        given(view2.getViewArtifact()).willReturn(new ViewArtifact("newartifact"));
        DefaultSpringFacesContextTest.this.springFacesContext.render(view2, model);
        verify(DefaultSpringFacesContextTest.this.facesContext).setViewRoot(newViewRoot);
        return null;
      }
    }).given(lifecycle).render((FacesContext) any());
View Full Code Here

  @Override
  protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
    if (request.getAttribute(DISABLE_ATTRIBUTE) != null) {
      return null;
    }
    ViewArtifact viewArtifact = this.stateHandler.read(request);
    if (viewArtifact == null) {
      return null;
    }
    Object orginalHandler = getOriginalHandler(request);
    return new HandlerExecutionChain(new Postback(viewArtifact, orginalHandler), getHandlerInterceptors());
View Full Code Here

  }

  public ModelAndView handle(final HttpServletRequest request, HttpServletResponse response, final Object handler)
      throws Exception {
    Assert.state(supports(handler), "The specified handler is not supported");
    ViewArtifact viewArtifact = ((Postback) handler).getViewArtifact();
    SpringFacesContext.getCurrentInstance(true).render(new FacesView(viewArtifact), null);
    return null;
  }
View Full Code Here

  public String getViewId() {
    return getUrl();
  }

  public ViewArtifact getViewArtifact() {
    return new ViewArtifact(getUrl());
  }
View Full Code Here

TOP

Related Classes of org.springframework.springfaces.mvc.render.ViewArtifact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.