Examples of CacheControl


Examples of javax.ws.rs.core.CacheControl

     * Set the caching header on the response
     * @param builder Response builder to put the caching header on
     * @param maxAgeSecs Max retention time on the client. Only set if the value is > 0
     */
    protected void setCachingHeader(Response.ResponseBuilder builder, int maxAgeSecs) {
        CacheControl cc = new CacheControl();
        cc.setPrivate(false);
        cc.setNoCache(false);
        cc.setNoStore(false);
        if (maxAgeSecs>-1)
            cc.setMaxAge(maxAgeSecs);
        builder.cacheControl(cc);
    }
View Full Code Here

Examples of javax.ws.rs.core.CacheControl

        if (!listList.isEmpty()) {
            List<MeasurementDataNumericHighLowComposite> list = listList.get(0);
            fillInDatapoints(res, list, scheduleId, hideEmpty, isHtml);
        }

        CacheControl cc = new CacheControl();
        int maxAge = (int) (schedule.getInterval() / 1000L)/2; // millis  ; half of schedule interval
        cc.setMaxAge(maxAge); // these are seconds
        cc.setPrivate(false);
        cc.setNoCache(false);

        Response.ResponseBuilder builder;
        if (isHtml) {
            String htmlString = renderTemplate("metricData", res);
            builder = Response.ok(htmlString,mediaType);
View Full Code Here

Examples of mondrian.olap.CacheControl

    putValue(Action.ACCELERATOR_KEY, ActionMessages.getOptionalKeyStroke("ClearMondrianCacheAction.Accelerator"));
  }

  public void actionPerformed(final ActionEvent e)
  {
    final CacheControl cacheControl = AggregationManager.instance().getCacheControl(null, null);
    cacheControl.flushSchemaCache();
  }
View Full Code Here

Examples of mondrian.olap.CacheControl

    {
      final Connection connection =
          mondrianConnectionProvider.createConnection(computeProperties(parameters), dataSourceProvider.getDataSource());
      try
      {
        final CacheControl cacheControl = connection.getCacheControl(null);
        if (onlyCurrentSchema)
        {
          cacheControl.flushSchema(connection.getSchema());
        }
        else
        {
          cacheControl.flushSchemaCache();
        }
      }
      finally
      {
        connection.close();
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.core.CacheControl

public class CacheControlHeaderParser
{
   public static CacheControl fromString(String value) throws IllegalArgumentException
   {
      if (value == null) throw new IllegalArgumentException("Cache-Control value is null");
      CacheControl result = new CacheControl();

      String[] directives = value.split(",");
      for (String directive : directives)
      {
         directive = directive.trim();

         String[] nv = directive.split("=");
         String name = nv[0].trim();
         String val = null;
         if (nv.length > 1)
         {
            val = nv[1].trim();
            if (val.startsWith("\"")) val = val.substring(1);
            if (val.endsWith("\"")) val = val.substring(0, val.length() - 1);
         }

         String lowercase = name.toLowerCase();
         if ("no-cache".equals(lowercase))
         {
            result.setNoCache(true);
            if (val != null && !"".equals(val))
            {
               result.getNoCacheFields().add(val);
            }
         }
         else if ("private".equals(lowercase))
         {
            result.setPrivate(true);
            if (val != null && !"".equals(val))
            {
               result.getPrivateFields().add(val);
            }
         }
         else if ("no-store".equals(lowercase))
         {
            result.setNoStore(true);
         }
         else if ("max-age".equals(lowercase))
         {
            if (val == null)
               throw new IllegalArgumentException("CacheControl max-age header does not have a value: " + value);
            result.setMaxAge(Integer.valueOf(val));
         }
         else if ("s-maxage".equals(lowercase))
         {
            if (val == null)
               throw new IllegalArgumentException("CacheControl s-maxage header does not have a value: " + value);
            result.setSMaxAge(Integer.valueOf(val));
         }
         else if ("no-transform".equals(lowercase))
         {
            result.setNoTransform(true);
         }
         else if ("must-revalidate".equals(lowercase))
         {
            result.setMustRevalidate(true);
         }
         else if ("proxy-revalidate".equals(lowercase))
         {
            result.setProxyRevalidate(true);
         }
         else if ("public".equals(lowercase))
         {
             result.setPublic(true);
         }
         else
         {
            if (val == null) val = "";
            result.getCacheExtension().put(name, val);
         }
      }
      return result;
   }
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.core.CacheControl

    }
    response = new ResponseWrapper(response, request.getContextPath());

    response.setContentType("text/cache-manifest");
    response.setCharacterEncoding("UTF-8");
    CacheControl cache = new CacheControl();
    cache.setNoCache(true);
    response.addHeader(HttpHeaderNames.CACHE_CONTROL, CacheControlHeaderParser.toString(cache));
    response.addDateHeader(HttpHeaderNames.EXPIRES, System.currentTimeMillis());
    if (dateModified > 0)
    {
      response.addDateHeader(HttpHeaderNames.LAST_MODIFIED, dateModified);
View Full Code Here

Examples of org.gatein.pc.api.cache.CacheControl

            // Invoke
            PortletInvocationResponse response = super.invoke(invocation);

            // Try to cache any fragment result
            CacheControl control = null;
            if (response instanceof ContentResponse)
            {
               fragment = (ContentResponse)response;
               control = fragment.getCacheControl();
            }
            else if (response instanceof RevalidateMarkupResponse)
            {
               RevalidateMarkupResponse revalidate = (RevalidateMarkupResponse)response;
               control = revalidate.getCacheControl();
            }

            // Compute expiration time, i.e when it will expire
            long expirationTimeMillis = 0;
            String validationToken = null;
            if (control != null)
            {
               if (control.getExpirationSecs() == -1)
               {
                  expirationTimeMillis = Long.MAX_VALUE;
               }
               else if (control.getExpirationSecs() > 0)
               {
                  expirationTimeMillis = System.currentTimeMillis() + control.getExpirationSecs() * 1000;
               }
               if (control.getValidationToken() != null)
               {
                  validationToken = control.getValidationToken();
               }
               else if (cachedEntry != null)
               {
                  validationToken = cachedEntry.validationToken;
               }
View Full Code Here

Examples of org.jboss.portal.portlet.cache.CacheControl

            // Invoke
            PortletInvocationResponse response = super.invoke(invocation);

            // Try to cache any fragment result
            CacheControl control = null;
            if (response instanceof ContentResponse)
            {
               fragment = (ContentResponse)response;
               control = fragment.getCacheControl();
            }
            else if (response instanceof RevalidateMarkupResponse)
            {
               RevalidateMarkupResponse revalidate = (RevalidateMarkupResponse)response;
               control = revalidate.getCacheControl();
            }

            // Compute expiration time, i.e when it will expire
            long expirationTimeMillis = 0;
            String validationToken = null;
            if (control != null)
            {
               if (control.getExpirationSecs() == -1)
               {
                  expirationTimeMillis = Long.MAX_VALUE;
               }
               else if (control.getExpirationSecs() > 0)
               {
                  expirationTimeMillis = System.currentTimeMillis() + control.getExpirationSecs() * 1000;
               }
               if (control.getValidationToken() != null)
               {
                  validationToken = control.getValidationToken();
               }
               else if (cachedEntry != null)
               {
                  validationToken = cachedEntry.validationToken;
               }
View Full Code Here

Examples of org.oasis.wsrp.v1.CacheControl

      return URLTools.replaceURLsBy(markup, rewriter);
   }

   private org.gatein.pc.api.cache.CacheControl createCacheControl(MarkupContext markupContext)
   {
      CacheControl cacheControl = markupContext.getCacheControl();
      org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;

      int expires;
      if (cacheControl != null)
      {
         expires = cacheControl.getExpires();
         String userScope = cacheControl.getUserScope();

         // check that we support the user scope...
         if (consumer.supportsUserScope(userScope))
         {
            log.debug("RenderHandler.processRenderRequest: trying to cache markup " + userScope + " for " + expires + " seconds.");
            CacheScope scope;
            if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
            {
               scope = CacheScope.PUBLIC;
            }
            else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
            {
               scope = CacheScope.PRIVATE;
            }
            else
            {
               throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
            }

            result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
         }
      }

      return result;
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.CacheControl

      return markup;
   }

   protected org.gatein.pc.api.cache.CacheControl createCacheControl(LocalMimeResponse mimeResponse)
   {
      CacheControl cacheControl = mimeResponse.getCacheControl();
      org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;

      int expires;
      if (cacheControl != null)
      {
         expires = cacheControl.getExpires();
         String userScope = cacheControl.getUserScope();

         // check that we support the user scope...
         if (consumer.supportsUserScope(userScope))
         {
            if (debug)
            {
               log.debug("Trying to cache markup " + userScope + " for " + expires + " seconds.");
            }
            CacheScope scope;
            if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
            {
               scope = CacheScope.PUBLIC;
            }
            else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
            {
               scope = CacheScope.PRIVATE;
            }
            else
            {
               throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
            }

            result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
         }
      }

      return result;
   }
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.