Package javax.ws.rs.core

Examples of javax.ws.rs.core.CacheControl


  public ScannerInstanceResource(String table, String id,
      ResultGenerator generator, int batch) throws IOException {
    this.id = id;
    this.generator = generator;
    this.batch = batch;
    cacheControl = new CacheControl();
    cacheControl.setNoCache(true);
    cacheControl.setNoTransform(false);
  }
View Full Code Here


        } else {
            GenericEntity<List<Link>> list = new GenericEntity<List<Link>>(links) {
            };
            builder.entity(list);
        }
        CacheControl cacheControl = new CacheControl();
        cacheControl.setMaxAge(86400); // TODO 1 day or longer? What unit is this anyway?
        builder.cacheControl(cacheControl);
        return builder.build();
    }
View Full Code Here

        } else {
            GenericEntity<List<Link>> list = new GenericEntity<List<Link>>(links) {
            };
            builder = Response.ok(list);
        }
        CacheControl cacheControl = new CacheControl();
        cacheControl.setMaxAge(86400); // TODO 1 day or longer? What unit is this anyway?
        builder.cacheControl(cacheControl);
        return builder.build();
    }
View Full Code Here

        } else {
            builder = Response.ok(hist);
        }
        if (history.getStatus()== OperationRequestStatus.SUCCESS) {
            // add a long time cache header
            CacheControl cc = new CacheControl();
            cc.setMaxAge(1200);
            builder.cacheControl(cc);
        }

        return builder.build();
View Full Code Here

     * 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

        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

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

        CacheControl cc = new CacheControl();
        int maxAge = (int) (definition.getDefaultInterval() / 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

        MeasurementSchedule schedule;
        Response.ResponseBuilder builder;

        // Create a cache control
        CacheControl cc = new CacheControl();
        cc.setMaxAge(300); // Schedules are valid for 5 mins
        cc.setPrivate(false); // Proxies may cache this

        schedule = getFromCache(scheduleId, MeasurementSchedule.class);
        if (schedule!=null) {
                // If it is on cache, quickly return if match
            long tim = schedule.getMtime() != null ? schedule.getMtime() : 0;
View Full Code Here

    this.table = table;
    this.rowspec = new RowSpec(rowspec);
    if (versions != null) {
      this.rowspec.setMaxVersions(Integer.valueOf(versions));
    }
    cacheControl = new CacheControl();
    cacheControl.setMaxAge(RESTServlet.getInstance().getMaxAge(table));
    cacheControl.setNoTransform(false);
  }
View Full Code Here

                noCache = true;
                addFields(noCacheFields, token);
            }
        }
       
        CacheControl cc = new CacheControl();
        cc.setMaxAge(maxAge);
        cc.setSMaxAge(sMaxAge);
        cc.setPrivate(isPrivate);
        cc.getPrivateFields().addAll(privateFields);
        cc.setMustRevalidate(mustRevalidate);
        cc.setProxyRevalidate(proxyRevalidate);
        cc.setNoCache(noCache);
        cc.getNoCacheFields().addAll(noCacheFields);
        cc.setNoStore(noStore);
        cc.setNoTransform(noTransform);
       
        return cc;
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.CacheControl

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.