本文整理汇总了Java中org.springframework.extensions.webscripts.Cache.setNeverCache方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.setNeverCache方法的具体用法?Java Cache.setNeverCache怎么用?Java Cache.setNeverCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.extensions.webscripts.Cache
的用法示例。
在下文中一共展示了Cache.setNeverCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeImpl
import org.springframework.extensions.webscripts.Cache; //导入方法依赖的package包/类
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(WebScriptRequest, Status, Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest request, Status status, Cache cache)
{
Map<String, Object> result = new HashMap<String, Object>();
cache.setNeverCache(true);
LicenseDescriptor licenseDescriptor = descriptorService.getLicenseDescriptor();
boolean isEnterprise = (licenseDescriptor == null ? false : (licenseDescriptor.getLicenseMode() == LicenseMode.ENTERPRISE));
result.put(IS_ENTERPRISE, Boolean.valueOf(isEnterprise));
result.put(RESULT_IMPORT_STATUS, bulkImporter.getStatus());
return(result);
}
示例2: streamContentImpl
import org.springframework.extensions.webscripts.Cache; //导入方法依赖的package包/类
protected void streamContentImpl(WebScriptRequest req, WebScriptResponse res,
ContentReader reader, NodeRef nodeRef, QName propertyQName,
boolean attach, Date modified, String eTag, String attachFileName)
throws IOException
{
delegate.setAttachment(req, res, attach, attachFileName);
// establish mimetype
String mimetype = reader.getMimetype();
String extensionPath = req.getExtensionPath();
if (mimetype == null || mimetype.length() == 0)
{
mimetype = MimetypeMap.MIMETYPE_BINARY;
int extIndex = extensionPath.lastIndexOf('.');
if (extIndex != -1)
{
String ext = extensionPath.substring(extIndex + 1);
mimetype = mimetypeService.getMimetype(ext);
}
}
// set mimetype for the content and the character encoding + length for the stream
res.setContentType(mimetype);
res.setContentEncoding(reader.getEncoding());
res.setHeader("Content-Length", Long.toString(reader.getSize()));
// set caching
Cache cache = new Cache();
cache.setNeverCache(false);
cache.setMustRevalidate(true);
cache.setMaxAge(0L);
cache.setLastModified(modified);
cache.setETag(eTag);
res.setCache(cache);
}
示例3: setResponseCache
import org.springframework.extensions.webscripts.Cache; //导入方法依赖的package包/类
/**
* Set the cache settings on the response
*
* @param res WebScriptResponse
* @param modified Date
* @param eTag String
*/
protected void setResponseCache(WebScriptResponse res, Date modified, String eTag, Map<String, Object> model)
{
Cache cache = new Cache();
Object obj;
if (model != null && (obj = model.get(KEY_CACHE_DIRECTIVE)) instanceof CacheDirective)
{
CacheDirective cacheDirective = (CacheDirective) obj;
cache.setNeverCache(cacheDirective.isNeverCache());
cache.setMustRevalidate(cacheDirective.isMustRevalidate());
cache.setMaxAge(cacheDirective.getMaxAge());
cache.setLastModified(cacheDirective.getLastModified());
cache.setETag(cacheDirective.getETag());
cache.setIsPublic(cacheDirective.isPublic());
}
else if (model == null || !getBooleanValue(model.get(KEY_ALLOW_BROWSER_TO_CACHE)))
{
// if 'allowBrowserToCache' is null or false
cache.setNeverCache(false);
cache.setMustRevalidate(true);
cache.setMaxAge(0L);
cache.setLastModified(modified);
cache.setETag(eTag);
}
else
{
cache.setNeverCache(false);
cache.setMustRevalidate(false);
cache.setMaxAge(Long.valueOf(31536000));// one year
cache.setLastModified(modified);
cache.setETag(eTag);
}
res.setCache(cache);
}