Examples of CacheControl


Examples of com.dotcms.repackage.javax.ws.rs.core.CacheControl

  @PUT
  public Response doPut(@Context HttpServletRequest request, @PathParam("params") String params) throws URISyntaxException {

    InitDataObject auth = init(null, true, request, false);
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    User user = auth.getUser();
    String username = (user != null) ? user.getFullName() : " unknown ";
    ResponseBuilder builder = Response.ok("{\"result\":\"" + username + " PUT!\"}", "application/json");
    return builder.cacheControl(cc).build();
  }
View Full Code Here

Examples of com.gitblit.wicket.CacheControl

  }

  @Override
  protected void setLastModified() {
    if (getClass().isAnnotationPresent(CacheControl.class)) {
      CacheControl cacheControl = getClass().getAnnotation(CacheControl.class);
      switch (cacheControl.value()) {
      case REPOSITORY:
        RepositoryModel repository = getRepositoryModel();
        if (repository != null) {
          setLastModified(repository.lastChange);
        }
View Full Code Here

Examples of com.proofpoint.http.client.CacheControl

    private Duration extractMaxAge(Response response)
    {
        String header = response.getHeader(HttpHeaders.CACHE_CONTROL);
        if (header != null) {
            CacheControl cacheControl = CacheControl.valueOf(header);
            if (cacheControl.getMaxAge() > 0) {
                return new Duration(cacheControl.getMaxAge(), TimeUnit.SECONDS);
            }
        }
        return DEFAULT_DELAY;
    }
View Full Code Here

Examples of com.volantis.mcs.policies.CacheControl

    // Javadoc inherited.
    public ProviderResult retrieve(
            SystemClock clock, Object key, CacheEntry entry) {

        CacheControl cacheControl;
        ActivatedPolicy policy;
        Throwable throwable = null;
        try {
            policy = retriever.retrievePolicy(project, name);

            // todo need to be able to handle the case where the policy could
            // todo not be retrieved but the project for the policy was found
            // todo and is not the same as the supplied one. i.e. when a
            // todo request is made to a remote repository which finds the
            // todo project for the policy but not the policy. The reason we
            // todo need to do that is because we need to use the actual
            // todo project for the policy to get default cache control stuff.

            if (policy == null) {
                cacheControl = cache.getDefaultCacheControl(project, key);
            } else {
                // Determine whether the policy is cacheable.
                cacheControl = policy.getCacheControl();
            }

        } catch (Throwable e) {
            // Catch all exceptions so that they will trigger the retry
            // mechanism if configured.
            if (logger.isErrorEnabled()) {
                logger.error(e);
            }

            cacheControl = cache.getDefaultCacheControl(project, key);
            policy = null;

            // Remember the throwable so that it can be returned back to the
            // cache which will place the entry into the error state.
            throwable = e;
        }

        // If this is cacheable then update the state, either the one
        // associated with the entry, or a newly created one if the entry has
        // not been supplied, or does not have one. The latter will only occur
        // if this is the first time that a policy is being retrieved for the
        // entry.
        //
        // If this is not cacheable then there is no point in updating the
        // state as while it will be stored in the entry it will not be used.
        // Therefore, in that case return null so that state based on an
        // uncacheable policy is not stored in the entry.

        final boolean cacheable = cacheControl.getCacheThisPolicy();
        CachedPolicyState state = null;
        if (cacheable) {

            ActivatedPolicy expiredPolicy = null;
View Full Code Here

Examples of io.airlift.http.client.CacheControl

    private Duration extractMaxAge(Response response)
    {
        String header = response.getHeader(HttpHeaders.CACHE_CONTROL);
        if (header != null) {
            CacheControl cacheControl = CacheControl.valueOf(header);
            if (cacheControl.getMaxAge() > 0) {
                return new Duration(cacheControl.getMaxAge(), TimeUnit.SECONDS);
            }
        }
        return DEFAULT_DELAY;
    }
View Full Code Here

Examples of javax.portlet.CacheControl

    when(portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId)).thenReturn(portletDescriptor);

        when(urlSyntaxProvider.getPortalRequestInfo(httpRequest)).thenReturn(portalRequestInfo);
   
    final CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> cacheState = cacheControlService.getPortletRenderState(httpRequest, portletWindowId);
    final CacheControl cacheControl = cacheState.getCacheControl();
    assertFalse(cacheControl.isPublicScope());
   
        cacheControl.setETag("123456");
       
        final PortletRenderResult portletResult = new PortletRenderResult("title", null, 0, 1);
        final String content = "<p>Cached content</p>";
       
        final CachedPortletData<PortletRenderResult> cachedPortletData = new CachedPortletData<PortletRenderResult>(
                portletResult, content, null, null, cacheControl.isPublicScope(),
                cacheControl.getETag(), -2);
       
        cacheControlService.cachePortletRenderOutput(portletWindowId, nextHttpRequest, cacheState, cachedPortletData);
   
        when(urlSyntaxProvider.getPortalRequestInfo(nextHttpRequest)).thenReturn(portalRequestInfo);
       
View Full Code Here

Examples of javax.ws.rs.core.CacheControl

      String exp = (String) response.getHeaders().getFirst(HttpHeaders.EXPIRES);
      int expires = -1;

      if (cc != null)
      {
         CacheControl cacheControl = CacheControl.valueOf(cc);
         if (cacheControl.isNoCache()) return response;
         expires = cacheControl.getMaxAge();
      }
      else if (exp != null)
      {
         Date date = DateUtil.parseDate(exp);
         expires = (int) ((date.getTime() - System.currentTimeMillis()) / 1000);
View Full Code Here

Examples of javax.ws.rs.core.CacheControl

      {
         initCacheControl(methodCached);
      }
      else if (noMethodCache != null)
      {
         cacheControl = new CacheControl();
         cacheControl.setNoCache(true);
      }
      else if (cache != null)
      {
         initCacheControl(cache);
      }
      else if (nocache != null)
      {
         cacheControl = new CacheControl();
         cacheControl.setNoCache(true);
         for (String field : nocache.fields()) cacheControl.getNoCacheFields().add(field);
      }

      return cacheControl != null;
View Full Code Here

Examples of javax.ws.rs.core.CacheControl

      return cacheControl != null;
   }

   protected void initCacheControl(Cache methodCached)
   {
      cacheControl = new CacheControl();
      if (methodCached.isPrivate())
      {
         cacheControl.setPrivate(true);
      }
      if (methodCached.maxAge() > -1)
View Full Code Here

Examples of javax.ws.rs.core.CacheControl

      String exp = (String) response.getHeaders().getFirst(HttpHeaders.EXPIRES);
      int expires = -1;

      if (cc != null)
      {
         CacheControl cacheControl = CacheControl.valueOf(cc);
         if (cacheControl.isNoCache())
         {
            return createClientResponse(request, old);
         }
         expires = cacheControl.getMaxAge();
      }
      else if (exp != null)
      {
         Date date = DateUtil.parseDate(exp);
         expires = (int) ((date.getTime() - System.currentTimeMillis()) / 1000);
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.