Examples of BookmarkableView


Examples of org.springframework.springfaces.mvc.servlet.view.BookmarkableView

  public void render(Map<String, ?> model, FacesContext facesContext) throws Exception {
    HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
    NativeWebRequest webRequest = new FacesWebRequest(facesContext);
    String url = buildRedirectUrl(request);
    Map<String, ?> relevantModel = getRelevantModel(webRequest, url, model);
    BookmarkableView delegate = createDelegateRedirector(url);
    if (delegate instanceof FacesRenderedView) {
      ((FacesRenderedView) delegate).render(relevantModel, facesContext);
    } else {
      HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
      delegate.render(relevantModel, request, response);
    }
  }
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.BookmarkableView

  }

  @Test
  public void shouldCreateBookmarkableRedirectViewDelegate() throws Exception {
    RequestMappedRedirectView view = new RequestMappedRedirectView(this.context, this.handler, this.handlerMethod);
    BookmarkableView delegatge = view.createDelegateRedirector("/url");
    assertThat(delegatge, is(instanceOf(BookmarkableRedirectView.class)));
  }
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.BookmarkableView

  @Test
  public void shouldGetResolvableBookmark() throws Exception {
    SpringFacesContextSetter.setCurrentInstance(this.springFacesContext);
    DestinationAndModel destinationAndModel = mock(DestinationAndModel.class);
    BookmarkableView destination = mock(BookmarkableView.class);
    given(destinationAndModel.getDestination()).willReturn(destination);
    given(destination.getBookmarkUrl(anyModel(), any(HttpServletRequest.class))).willReturn("/bookmark");
    given(this.destinationAndModelRegistry.get(this.context, this.viewId)).willReturn(destinationAndModel);
    Map<String, List<String>> parameters = new HashMap<String, List<String>>();
    boolean includeViewParams = false;
    String bookmark = this.handler.getBookmarkableURL(this.context, this.viewId, parameters, includeViewParams);
    assertThat(bookmark, is(equalTo("/bookmark")));
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.BookmarkableView

  @Test
  public void shouldRedirectUsingResolvedBookmarkUrl() throws Exception {
    SpringFacesContextSetter.setCurrentInstance(this.springFacesContext);
    DestinationAndModel destinationAndModel = mock(DestinationAndModel.class);
    BookmarkableView destination = mock(BookmarkableView.class);
    given(destinationAndModel.getDestination()).willReturn(destination);
    given(destination.getBookmarkUrl(anyModel(), any(HttpServletRequest.class))).willReturn("/bookmark");
    given(this.destinationAndModelRegistry.get(this.context, this.viewId)).willReturn(destinationAndModel);
    Map<String, List<String>> parameters = new HashMap<String, List<String>>();
    boolean includeViewParams = false;
    String redirect = this.handler.getRedirectURL(this.context, this.viewId, parameters, includeViewParams);
    assertThat(redirect, is(equalTo("/bookmark")));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.