本文整理汇总了Java中javax.ws.rs.core.Response.ResponseBuilder.lastModified方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseBuilder.lastModified方法的具体用法?Java ResponseBuilder.lastModified怎么用?Java ResponseBuilder.lastModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ws.rs.core.Response.ResponseBuilder
的用法示例。
在下文中一共展示了ResponseBuilder.lastModified方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBlobHeaders
import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
private ResponseBuilder makeBlobHeaders(ItemFile itemFile, String filename)
{
FileInfo fileInfo = fileSystemService.getFileInfo(itemFile, filename);
ResponseBuilder builder = Response.ok();
builder.lastModified(new Date(fileSystemService.lastModified(itemFile, filename)));
builder.header(HttpHeaders.ETAG, fileInfo.getMd5CheckSum());
builder.header(HttpHeaders.CONTENT_LENGTH, fileInfo.getLength());
builder.header(HttpHeaders.CONTENT_TYPE, mimeService.getMimeTypeForFilename(fileInfo.getFilename()));
return builder;
}
示例2: makeResponseHeaders
import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
private ResponseBuilder makeResponseHeaders(String uuid, String filepath) throws IOException
{
ResponseBuilder builder = Response.ok();
StagingFile handle = new StagingFile(uuid);
FileInfo fileInfo = fileSystemService.getFileInfo(handle, filepath);
builder.lastModified(new Date(fileSystemService.lastModified(handle, filepath)));
builder.header(HttpHeaders.CONTENT_LENGTH, fileInfo.getLength());
builder.header(HttpHeaders.CONTENT_TYPE, mimeService.getMimeTypeForFilename(fileInfo.getFilename()));
builder.header(HttpHeaders.ETAG, "\"" + fileSystemService.getMD5Checksum(handle, filepath) + "\"");
return builder;
}
示例3: basicGetResponseBuilder
import javax.ws.rs.core.Response.ResponseBuilder; //导入方法依赖的package包/类
private ResponseBuilder basicGetResponseBuilder(final Resource res, final Optional<RDFSyntax> syntax) {
final ResponseBuilder builder = ok();
// Standard HTTP Headers
builder.lastModified(from(res.getModified()));
final IRI model;
if (isNull(req.getExt())) {
syntax.ifPresent(s -> {
builder.header(VARY, PREFER);
builder.type(s.mediaType());
});
model = res.getBinary().isPresent() && syntax.isPresent() ? LDP.RDFSource : res.getInteractionModel();
// Link headers from User data
res.getExtraLinkRelations().collect(toMap(Entry::getKey, Entry::getValue))
.entrySet().forEach(entry -> builder.link(entry.getKey(), join(" ", entry.getValue())));
} else {
model = LDP.RDFSource;
}
// Add LDP-required headers
ldpResourceTypes(model).forEach(type -> {
builder.link(type.getIRIString(), "type");
// Mementos don't accept POST or PATCH
if (LDP.Container.equals(type) && !res.isMemento()) {
builder.header(ACCEPT_POST, MEDIA_TYPES.stream()
.map(mt -> mt.getType() + "/" + mt.getSubtype())
// text/html is excluded
.filter(mt -> !TEXT_HTML.equals(mt)).collect(joining(",")));
} else if (LDP.RDFSource.equals(type) && !res.isMemento()) {
builder.header(ACCEPT_PATCH, APPLICATION_SPARQL_UPDATE);
}
});
// Memento-related headers
if (res.isMemento()) {
builder.header(MEMENTO_DATETIME, from(res.getModified()));
} else {
builder.header(VARY, ACCEPT_DATETIME);
}
return builder;
}