Package ch.entwine.weblounge.common.impl.request

Examples of ch.entwine.weblounge.common.impl.request.CacheTagSet


      if (!noCache && request.getVersion() == Resource.LIVE) {
        long expirationTime = action.getCacheExpirationTime();
        long revalidationTime = action.getClientRevalidationTime();

        // Create the set of tags that identify the request output
        CacheTagSet cacheTags = createCacheTags(request, action);

        // Check if the page is already part of the cache
        if (response.startResponse(cacheTags.getTags(), expirationTime, revalidationTime)) {
          logger.debug("Action answered request for {} from cache", request.getUrl());
          return true;
        }

        processingMode = Mode.Cached;
View Full Code Here


   * @param action
   *          the action
   * @return the cache tags
   */
  protected CacheTagSet createCacheTags(WebloungeRequest request, Action action) {
    CacheTagSet cacheTags = new CacheTagSet();
    cacheTags.add(CacheTag.Url, request.getUrl().getPath());
    cacheTags.add(CacheTag.Url, request.getRequestedUrl().getPath());
    cacheTags.add(CacheTag.Language, request.getLanguage().getIdentifier());
    cacheTags.add(CacheTag.User, request.getUser().getLogin());
    cacheTags.add(CacheTag.Module, action.getModule().getIdentifier());
    cacheTags.add(CacheTag.Action, action.getIdentifier());
    Enumeration<?> pe = request.getParameterNames();
    int parameterCount = 0;
    while (pe.hasMoreElements()) {
      parameterCount++;
      String key = pe.nextElement().toString();
      String[] values = request.getParameterValues(key);
      for (String value : values) {
        cacheTags.add(key, value);
      }
    }
    cacheTags.add(CacheTag.Parameters, Integer.toString(parameterCount));
    return cacheTags;
  }
View Full Code Here

      // Check if the page is already part of the cache. If so, our task is
      // already done!
      if (!ignoreCache && request.getVersion() == Resource.LIVE && !isEditing) {

        // Create the set of tags that identify the page
        CacheTagSet cacheTags = createPrimaryCacheTags(request);

        if (action == null) {
          long expirationTime = Renderer.DEFAULT_VALID_TIME;
          long revalidationTime = Renderer.DEFAULT_RECHECK_TIME;

          // Check if the page is already part of the cache
          if (response.startResponse(cacheTags.getTags(), expirationTime, revalidationTime)) {
            logger.debug("Page handler answered request for {} from cache", request.getUrl());
            return true;
          }
        }

        processingMode = Mode.Cached;
        cacheTags.add(CacheTag.Resource, page.getURI().getIdentifier());
        response.addTags(cacheTags);

      } else if (Http11Constants.METHOD_HEAD.equals(requestMethod)) {
        // handle HEAD requests
        Http11Utils.startHeadResponse(response);
View Full Code Here

   * @param request
   *          the request
   * @return the cache tags
   */
  protected CacheTagSet createPrimaryCacheTags(WebloungeRequest request) {
    CacheTagSet cacheTags = new CacheTagSet();
    cacheTags.add(CacheTag.Url, request.getUrl().getPath());
    cacheTags.add(CacheTag.Url, request.getRequestedUrl().getPath());
    cacheTags.add(CacheTag.Language, request.getLanguage().getIdentifier());
    cacheTags.add(CacheTag.User, request.getUser().getLogin());
    Enumeration<?> pe = request.getParameterNames();
    int parameterCount = 0;
    while (pe.hasMoreElements()) {
      parameterCount++;
      String key = pe.nextElement().toString();
      String[] values = request.getParameterValues(key);
      for (String value : values) {
        cacheTags.add(key, value);
      }
    }
    cacheTags.add(CacheTag.Parameters, Integer.toString(parameterCount));
    return cacheTags;
  }
View Full Code Here

   * @param request
   *          the request
   * @return the cache tags
   */
  protected CacheTagSet createCacheTags(WebloungeRequest request) {
    CacheTagSet cacheTags = new CacheTagSet();
    cacheTags.add(CacheTag.Url, request.getUrl().getPath());
    cacheTags.add(CacheTag.Url, request.getRequestedUrl().getPath());
    cacheTags.add(CacheTag.Language, request.getLanguage().getIdentifier());
    cacheTags.add(CacheTag.User, request.getUser().getLogin());
    Enumeration<?> pe = request.getParameterNames();
    int parameterCount = 0;
    while (pe.hasMoreElements()) {
      parameterCount++;
      String key = pe.nextElement().toString();
      String[] values = request.getParameterValues(key);
      for (String value : values) {
        cacheTags.add(key, value);
      }
    }
    cacheTags.add(CacheTag.Parameters, Integer.toString(parameterCount));
    return cacheTags;
  }
View Full Code Here

    if (!noCache) {
      long expirationTime = Renderer.DEFAULT_VALID_TIME;
      long revalidationTime = Renderer.DEFAULT_RECHECK_TIME;

      // Create the set of tags that identify the request output
      CacheTagSet cacheTags = createPrimaryCacheTags(request);

      // Check if the page is already part of the cache
      if (response.startResponse(cacheTags.getTags(), expirationTime, revalidationTime)) {
        logger.debug("Feed handler answered request for {} from cache", request.getUrl());
        return true;
      }
    }
View Full Code Here

   * @param request
   *          the request
   * @return the cache tags
   */
  protected CacheTagSet createPrimaryCacheTags(WebloungeRequest request) {
    CacheTagSet cacheTags = new CacheTagSet();
    cacheTags.add(CacheTag.Url, request.getUrl().getPath());
    cacheTags.add(CacheTag.Language, request.getLanguage().getIdentifier());
    cacheTags.add(CacheTag.User, request.getUser().getLogin());
    Enumeration<?> pe = request.getParameterNames();
    int parameterCount = 0;
    while (pe.hasMoreElements()) {
      parameterCount++;
      String key = pe.nextElement().toString();
      String[] values = request.getParameterValues(key);
      for (String value : values) {
        cacheTags.add(key, value);
      }
    }
    cacheTags.add(CacheTag.Parameters, Integer.toString(parameterCount));
    return cacheTags;
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.request.CacheTagSet

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.