org.mycore.frontend.jersey.MCRCacheControl Maven / Gradle / Ivy
/*
* This file is part of *** M y C o R e ***
* See http://www.mycore.de/ for details.
*
* MyCoRe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MyCoRe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MyCoRe. If not, see .
*/
package org.mycore.frontend.jersey;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;
/**
* Used to define the {@link javax.ws.rs.core.HttpHeaders#CACHE_CONTROL} header via annotation
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MCRCacheControl {
/**
* sets {@code private} directive
* @see private definition
*/
FieldArgument private_() default @FieldArgument();
/**
* sets {@code no-cache} directive
* @see no-cache definition
*/
FieldArgument noCache() default @FieldArgument;
/**
* if {@link #noCache()}, sets {@code noCache} directive argument to these values
* @see no-cache definition
*/
String[] noCacheFields() default {};
/**
* if true, sets {@code no-store} directive
* @see no-store definition
*/
boolean noStore() default false;
/**
* if true, sets {@code no-transform} directive
* @see no-transform definition
*/
boolean noTransform() default false;
/**
* if true, sets {@code must-revalidate} directive
* @see must-revalidate definition
*/
boolean mustRevalidate() default false;
/**
* if true, sets {@code proxy-revalidate} directive
* @see proxy-revalidate definition
*/
boolean proxyRevalidate() default false;
/**
* if true, sets {@code public} directive
* @see public definition
*/
boolean public_() default false;
/**
* Sets {@code max-age} directive
* @see max-age definition
*/
Age maxAge() default @Age(time = -1, unit = TimeUnit.SECONDS);
/**
* Sets {@code s-maxage} directive
* @see s-maxage definition
*/
Age sMaxAge() default @Age(time = -1, unit = TimeUnit.SECONDS);
/**
* Sets further Cache-Control Extensions
* @see Cache Control Extensions
*/
Extension[] extensions() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
@interface Age {
long time();
TimeUnit unit() default TimeUnit.MINUTES;
}
@interface FieldArgument {
/**
* if true, this directive is present in header value
*/
boolean active() default false;
/**
* if {@link #active()}, sets directive argument to these values
*/
String[] fields() default {};
}
@interface Extension {
String directive();
String argument() default "";
}
}