Package br.com.caelum.vraptor.actioncache

Examples of br.com.caelum.vraptor.actioncache.ActionCacheEntry


      @Override
      public ActionCacheEntry call() throws Exception {
        String result = charResponse.getOutput();
        logger.debug("Caching response of controller method with key {}",cached.key());
        return new ActionCacheEntry(result, charResponse.getHeaders());
      }
    });
  }
View Full Code Here


  @Override
  public void doTag() throws JspException, IOException {
    super.doTag();
    final StringWriter body = new StringWriter();
    CacheKey cacheKey = new CacheKey(key);
    ActionCacheEntry entry = actionCache.fetch(cacheKey);
    if (entry == null) {
      getJspBody().invoke(body);
      actionCache.write(cacheKey, new ActionCacheEntry(body.toString(), new HashMap<String, String>()));
    }
    getJspContext().getOut().println(actionCache.fetch(cacheKey).getResult());
  }
View Full Code Here

    Cached cached = cachedMethodExecuted.getCached();
    if (cached == null) {
      runnable.run();
      return;
    }
    ActionCacheEntry body = actionCache.fetch(new CacheKey(cached, requestHeaders));
    if (body == null) {
      runnable.run();
    }
  }
View Full Code Here

  public void execute(@Observes @WriteResponse CachedMethodExecuted executed) {
    try {
      Cached cached = executed.getCached();
      CharArrayWriterResponse charArrayResponse = ProxyTargetInstance.get(response);
      ActionCacheEntry entry = actionCache.fetch(new CacheKey(cached,requestHeaders));
      HttpServletResponse originalResponse = charArrayResponse.delegate();
      entry.copyHeadersTo(originalResponse);
      logger.debug("Using cached response for {}",cached.key());
      originalResponse.getWriter().print(entry.getResult());
    } catch (IOException e) {
      throw new ResultException(e);
    }
  }
View Full Code Here

  public void execute(@Observes @WriteResponse CachedMethodExecuted executed) {
    try {
      Cached cached = executed.getCached();
      CharArrayWriterResponse charArrayResponse = ProxyTargetInstance.get(response);
      ActionCacheEntry entry = actionCache.fetch(new CacheKey(cached,requestHeaders));
      HttpServletResponse originalResponse = charArrayResponse.delegate();
      entry.copyHeadersTo(originalResponse);
      logger.debug("Using cached response for {}", cached.key());
      originalResponse.getWriter().write(entry.getResult());
      originalResponse.flushBuffer();
    } catch (IOException e) {
      throw new ResultException(e);
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.actioncache.ActionCacheEntry

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.