本文整理了Java中org.restlet.Response.getCacheDirectives
方法的一些代码示例,展示了Response.getCacheDirectives
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getCacheDirectives
方法的具体详情如下:
包路径:org.restlet.Response
类名称:Response
方法名:getCacheDirectives
暂无
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth
public static void addCacheDirective(Response response,
CacheDirective cacheDirective) {
List<CacheDirective> cacheDirectives = response.getCacheDirectives();
if (cacheDirectives == null) {
cacheDirectives = new ArrayList<CacheDirective>();
response.setCacheDirectives(cacheDirectives);
}
cacheDirectives.add(cacheDirective);
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the response cache directives. Note that when used with HTTP
* connectors, this property maps to the "Cache-Control" header.
*
* @return The cache directives.
*/
public List<CacheDirective> getResponseCacheDirectives() {
return getResponse() == null ? null : getResponse()
.getCacheDirectives();
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@Get
public Representation represent() {
// Modification date (Fri, 17 Apr 2012 10:10:10 GMT) unchanged.
Calendar cal = new GregorianCalendar(2012, 4, 17, 10, 10, 10);
Representation result = new StringRepresentation("<a href="
+ getReference() + ">" + System.currentTimeMillis() + "</a>");
result.setMediaType(MediaType.TEXT_HTML);
result.setModificationDate(cal.getTime());
// Expiration date (Fri, 17 Apr 2012 13:10:10 GMT) unchanged.
cal.roll(Calendar.HOUR, 3);
result.setExpirationDate(cal.getTime());
// Setting E-Tag
result.setTag(new Tag("xyz123"));
// Setting a cache directive
getResponse().getCacheDirectives().add(CacheDirective.publicInfo());
return result;
}
代码示例来源:origin: unchartedsoftware/aperture-tiles
/**
* GET request. Returns all configuration states under a particular layer, including default.
*/
@Get
public Representation getStates() {
try {
String version = (String) getRequest().getAttributes().get("version");
if ( version == null ) {
version = LayerConfiguration.DEFAULT_VERSION;
}
String layerId = (String) getRequest().getAttributes().get("layer");
String stateId = (String) getRequest().getAttributes().get("state");
JSONObject result = new JSONObject();
if ( stateId != null ) {
result.put( "state", _service.getLayerState( layerId, stateId ) );
} else {
result.put( "states", _service.getLayerStates( layerId ) );
}
result.put( "version", version );
setStatus( Status.SUCCESS_OK );
getResponse().getCacheDirectives().add( CacheDirective.noCache() );
return new JsonRepresentation( result );
} catch ( Exception e ) {
LOGGER.warn("Bad layer states request: ", e);
throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,
"Unable to recognize layer id",
e);
}
}
代码示例来源:origin: unchartedsoftware/aperture-tiles
getResponse().getCacheDirectives().add( CacheDirective.noCache() );
return new JsonRepresentation( result );
代码示例来源:origin: org.restlet.osgi/org.restlet
WarningReader.addValues(header, response.getWarnings());
} else if (HEADER_CACHE_CONTROL.equalsIgnoreCase(header.getName())) {
CacheDirectiveReader.addValues(header, response.getCacheDirectives());
} else if (HEADER_ACCEPT_RANGES.equalsIgnoreCase(header.getName())) {
TokenReader tr = new TokenReader(header.getValue());
内容来源于网络,如有侵权,请联系作者删除!