本文整理匯總了Java中javax.ws.rs.core.CacheControl.setNoCache方法的典型用法代碼示例。如果您正苦於以下問題:Java CacheControl.setNoCache方法的具體用法?Java CacheControl.setNoCache怎麽用?Java CacheControl.setNoCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.ws.rs.core.CacheControl
的用法示例。
在下文中一共展示了CacheControl.setNoCache方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DefaultSmartcommitsService
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
@Autowired
public DefaultSmartcommitsService(@ComponentImport IssueManager issueManager,
@Qualifier ("smartcommitsTransitionsHandler") TransitionHandler transitionHandler,
@Qualifier ("smartcommitsCommentHandler") CommentHandler commentHandler,
@Qualifier ("smartcommitsWorklogHandler") WorkLogHandler workLogHandler,
@ComponentImport JiraAuthenticationContext jiraAuthenticationContext,
@ComponentImport CrowdService crowdService)
{
this.crowdService = checkNotNull(crowdService);
NO_CACHE = new CacheControl();
NO_CACHE.setNoCache(true);
this.issueManager = checkNotNull(issueManager);
this.transitionHandler = transitionHandler;
this.commentHandler = commentHandler;
this.workLogHandler = workLogHandler;
this.jiraAuthenticationContext = checkNotNull(jiraAuthenticationContext);
}
示例2: createCacheControl
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
/**
* Converts a {@code Cache-Control} annotation to a {@code Cache-Control}
* Jersey API object.
*
* @param annotation the annotation
*
* @return the Jersey API object
*
* @see javax.ws.rs.core.CacheControl
* @see com.github.autermann.jersey.cache.CacheControl
*/
private CacheControl createCacheControl(
com.github.autermann.jersey.cache.CacheControl annotation) {
CacheControl cacheControl = new CacheControl();
cacheControl.setPrivate(annotation._private() ||
annotation.privateFields().length > 0);
cacheControl.getPrivateFields()
.addAll(Arrays.asList(annotation.privateFields()));
cacheControl.setMustRevalidate(annotation.mustRevalidate());
cacheControl.setNoCache(annotation.noCache() ||
annotation.noCacheFields().length > 0);
cacheControl.getNoCacheFields()
.addAll(Arrays.asList(annotation.noCacheFields()));
cacheControl.setNoStore(annotation.noStore());
cacheControl.setNoTransform(annotation.noTransform());
cacheControl.setProxyRevalidate(annotation.proxyRevalidate());
cacheControl.setMaxAge(annotation.maxAge());
cacheControl.setSMaxAge(annotation.sMaxAge());
for (CacheControlExtension e : annotation.extensions()) {
cacheControl.getCacheExtension().put(e.key(), e.value());
}
return cacheControl;
}
示例3: fromString
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
@Override
public CacheControl fromString(final String value) {
if (value == null) {
return null;
}
final CacheControl result = new CacheControl();
result.setPrivate(true);
result.setNoTransform(false);
for (final String directive : value.split(",\\s+")) {
if (directive.startsWith("max-age=")) {
result.setMaxAge(Integer.parseInt(directive.split("=")[1]));
} else if (directive.equals("must-revalidate")) {
result.setMustRevalidate(true);
} else if (directive.equals("no-cache")) {
result.setNoCache(true);
} else if (directive.equals("no-store")) {
result.setNoStore(true);
} else if (directive.equalsIgnoreCase("no-transform")) {
result.setNoTransform(true);
} else if (directive.equals("private")) {
result.setPrivate(true);
} else if (directive.equals("proxy-revalidate")) {
result.setProxyRevalidate(true);
} else if (directive.equals("public")) {
result.setPrivate(false);
} else if (directive.startsWith("s-maxage=")) {
result.setSMaxAge(Integer.parseInt(directive.split("=")[1]));
}
}
return result;
}
示例4: testSerializeFull
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
@Test
public void testSerializeFull() {
final CacheControl c = new CacheControl();
c.setMaxAge(100);
c.setMustRevalidate(true);
c.setNoCache(true);
c.setNoStore(true);
c.setNoTransform(false);
c.setPrivate(true);
c.setProxyRevalidate(true);
c.setSMaxAge(200);
assertEquals(
"private, max-age=100, s-maxage=200, must-revalidate, no-cache, no-store, proxy-revalidate",
d.toString(c));
}
示例5: noCache
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
/**
* Edit the response headers to indicating no caching.
*
* @param response response
* @return builder
*/
protected Response.ResponseBuilder noCache(final Response.ResponseBuilder response) {
final CacheControl cacheControl = new CacheControl();
cacheControl.setPrivate(true);
cacheControl.setNoCache(true);
cacheControl.setNoStore(true);
return response.cacheControl(cacheControl);
}
示例6: createCacheControl
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
private static CacheControl createCacheControl(Cacheable cacheable) {
CacheControl cacheControl = new CacheControl();
cacheControl.setMaxAge(cacheable.maxAge());
cacheControl.setMustRevalidate(cacheable.mustRevalidate());
cacheControl.setNoCache(cacheable.noCache());
cacheControl.setNoStore(cacheable.noStore());
cacheControl.setNoTransform(cacheable.noTransform());
cacheControl.setPrivate(cacheable.privateFlag());
cacheControl.setProxyRevalidate(cacheable.proxyRevalidate());
cacheControl.setSMaxAge(cacheable.sMaxAge());
cacheControl.getNoCacheFields().addAll(Arrays.asList(cacheable.noCacheFields()));
cacheControl.getPrivateFields().addAll(Arrays.asList(cacheable.privateFields()));
return cacheControl;
}
示例7: buildResponse
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
/**
* Builds the response.
*
* @param o the o
* @return the response
*/
private Response buildResponse(Object o){
ResponseBuilder builder = Response.ok(o, MediaType.APPLICATION_JSON_TYPE);
CacheControl cacheControl = new CacheControl();
cacheControl.setNoCache(true);
builder.cacheControl(cacheControl);
builder.expires(DateUtils.adjustDay(new Date(), -1));
return builder.build();
}
示例8: response
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
private Response response(@Nonnull final Status status, @Nullable final Object body)
{
final CacheControl cacheControl = new CacheControl();
cacheControl.setNoCache(true);
cacheControl.setNoStore(true);
return Response
.status(status)
.entity(body)
.cacheControl(cacheControl)
.build();
}
示例9: buildErrorResponse
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
private Response buildErrorResponse(Response.Status status, String message)
{
CacheControl cacheControl = new CacheControl();
cacheControl.setNoCache(true);
cacheControl.setNoStore(true);
Response.ResponseBuilder responseBuilder = Response.status(status).entity(new Status(status, message)).cacheControl(cacheControl);
return responseBuilder.build();
}
示例10: getNoStoreCacheControl
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
public static final CacheControl getNoStoreCacheControl() {
CacheControl cc = new CacheControl();
cc.setNoCache(true);
cc.setNoStore(true);
cc.setMaxAge(0);
cc.setSMaxAge(0);
cc.setPrivate(true);
return cc;
}
示例11: getNoCacheResponseBuilder
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
public ResponseBuilder getNoCacheResponseBuilder(Response.Status status) {
CacheControl cc = new CacheControl();
cc.setNoCache(true);
cc.setMaxAge(-1);
cc.setMustRevalidate(true);
return Response.status(status).cacheControl(cc);
}
示例12: getNoCacheCORSResponseBuilder
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
public ResponseBuilder getNoCacheCORSResponseBuilder(Response.Status status) {
CacheControl cc = new CacheControl();
cc.setNoCache(true);
cc.setMaxAge(-1);
cc.setMustRevalidate(true);
return Response.status(status)
.header("Access-Control-Allow-Origin", "*")
.header("Access-Control-Allow-Methods", "GET")
.cacheControl(cc);
}
示例13: prepareTest
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
@Before
public void prepareTest() {
ClientConfig clientConfig = new ClientConfig();
client = ClientBuilder.newClient(clientConfig);
cacheControl = new CacheControl();
cacheControl.setNoCache(true);
cacheControl.setNoStore(true);
}
示例14: prompt
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
private Response prompt(String title, String message){
IPrompt p= new Prompt();
p.setMessage(title, message);
ResponseBuilder builder = Response.ok(p, MediaType.APPLICATION_JSON_TYPE);
CacheControl cacheControl = new CacheControl();
cacheControl.setNoCache(true);
builder.cacheControl(cacheControl);
builder.expires(DateUtils.adjustDay(new Date(), -1));
return builder.build();
}
示例15: buildResponse
import javax.ws.rs.core.CacheControl; //導入方法依賴的package包/類
private Response buildResponse(Object o){
ResponseBuilder builder = Response.ok(o, MediaType.APPLICATION_JSON_TYPE);
CacheControl cacheControl = new CacheControl();
cacheControl.setNoCache(true);
builder.cacheControl(cacheControl);
builder.expires(DateUtils.adjustDay(new Date(), -1));
return builder.build();
}