Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.View


  @Test
  public void test() throws Exception
  {

    View view = createStrictMock(View.class);
    Map model = createStrictMock(Map.class);
    ActionContext context = createStrictMock(ActionContext.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpServletResponse response = createStrictMock(HttpServletResponse.class);

    SpringRenderingViewAdapter va = new SpringRenderingViewAdapter(view, model);

    expect(context.getRequest()).andReturn(request);
    expect(context.getResponse()).andReturn(response);
    view.render(model, request, response);

    replay(context);
    replay(view);
    replay(model);
View Full Code Here


  @Test
  public void testException() throws Exception
  {

    View view = createStrictMock(View.class);
    Map model = createStrictMock(Map.class);
    ActionContext context = createStrictMock(ActionContext.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpServletResponse response = createStrictMock(HttpServletResponse.class);

    SpringRenderingViewAdapter va = new SpringRenderingViewAdapter(view, model);

    expect(context.getRequest()).andReturn(request);
    expect(context.getResponse()).andReturn(response);
    view.render(model, request, response);
    expectLastCall().andThrow(new IllegalStateException());

    replay(context);
    replay(view);
    replay(model);
View Full Code Here

  }

  @SpringView()
  public ModelAndView getResult()
  {
    View view = new AbstractExcelView()
    {

      protected void buildExcelDocument(Map model, HSSFWorkbook workbook, HttpServletRequest request,
          HttpServletResponse response) throws Exception
      {
View Full Code Here

    // update the request with the LocaleResolver
    HttpServletRequest request = actionContext.getRequest();
    request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, localeResolver);

    View view = null;

    if (modelAndView.isReference())
    {

      // non-default resolver supplied: use resolver to get view
View Full Code Here

      }
   }

   protected ModelAndView createModelAndView(ServerResponse serverResponse)
   {
      View view = createView(serverResponse);
      return new ModelAndView(view, "responseInvoker", serverResponse);
   }
View Full Code Here

    public Map<String, View> getViews() {
        return views;
    }
   
    public View getView(String format) {
        View view = views.get(format);
        if (view == null) {
            view = views.get(defaultFormat);
        }
        return view;
    }
View Full Code Here

            final String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
            return new AjaxRedirectView(
                    this.ajaxHandler, redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible());
        }
       
        final View view = super.createView(viewName, locale);
       
        if (view instanceof AjaxEnabledView) {
            // Set the AJAX handler into view, if it is an AjaxThymeleafView.
           
            final AjaxEnabledView ajaxEnabledView = (AjaxEnabledView) view;
View Full Code Here

            final String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
            return new AjaxRedirectView(
                    this.ajaxHandler, redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible());
        }
       
        final View view = super.createView(viewName, locale);
       
        if (view instanceof AjaxEnabledView) {
            // Set the AJAX handler into view, if it is an AjaxThymeleafView.
           
            final AjaxEnabledView ajaxEnabledView = (AjaxEnabledView) view;
View Full Code Here

    setCacheSeconds(10);
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("Greeting", "Hello World");
    model.put("Server time", new Date());
   
    View view = (View)getApplicationContext().getBean("plainTextView");
   
    return new ModelAndView(view, model);
  }
View Full Code Here

      return createView(viewName, locale);
    }
    else {
      Object cacheKey = getCacheKey(viewName, locale);
      synchronized (this.viewCache) {
        View view = (View) this.viewCache.get(cacheKey);
        if (view == null) {
          // Ask the subclass to create the View object.
          view = createView(viewName, locale);
          this.viewCache.put(cacheKey, view);
          if (logger.isTraceEnabled()) {
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.View

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.