ServerCacheControl extends CacheControl { public static ServerCacheControl parse(String... directives) { return parse(ImmutableList.copyOf(requireNonNull(directives, "directives"))); } ServerCacheControl(boolean noCache, boolean noStore, boolean noTransform, long maxAgeSeconds,
                       boolean cachePublic, boolean cachePrivate, boolean immutable,
                       boolean mustRevalidate, boolean proxyRevalidate, long sMaxAgeSeconds); static ServerCacheControl parse(String... directives); static ServerCacheControl parse(Iterable<String> directives); static ServerCacheControlBuilder builder(); @Override boolean isEmpty(); boolean cachePublic(); boolean cachePrivate(); boolean immutable(); boolean mustRevalidate(); boolean proxyRevalidate(); long sMaxAgeSeconds(); @Override ServerCacheControlBuilder toBuilder(); @Override String asHeaderValue(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); static final ServerCacheControl EMPTY; static final ServerCacheControl DISABLED; static final ServerCacheControl REVALIDATED; static final ServerCacheControl IMMUTABLE; }
@Test public void testParse() { assertThat(ServerCacheControl.parse("")).isEqualTo(ServerCacheControl.EMPTY); assertThat(ServerCacheControl.parse("only-if-cached, stall-if-error=1")) .isEqualTo(ServerCacheControl.EMPTY); assertThat(ServerCacheControl.parse("no-cache, no-store, no-transform, must-revalidate, " + "max-age=1, public, private, immutable, proxy-revalidate, " + "s-maxage=2")) .isEqualTo(ServerCacheControl.builder() .noCache() .noStore() .noTransform() .maxAgeSeconds(1) .cachePrivate() .immutable() .mustRevalidate() .proxyRevalidate() .sMaxAgeSeconds(2) .build()); }