本文整理匯總了Java中org.restlet.representation.Representation.getExpirationDate方法的典型用法代碼示例。如果您正苦於以下問題:Java Representation.getExpirationDate方法的具體用法?Java Representation.getExpirationDate怎麽用?Java Representation.getExpirationDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.restlet.representation.Representation
的用法示例。
在下文中一共展示了Representation.getExpirationDate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addEntityHeaders
import org.restlet.representation.Representation; //導入方法依賴的package包/類
/**
* Adds the entity headers based on the {@link Representation} to the {@link Series}.
*
* @param entity
* The source entity {@link Representation}.
* @param headers
* The target headers {@link Series}.
*/
public static void addEntityHeaders(Representation entity,
Series<Header> headers) {
if (entity == null || !entity.isAvailable()) {
addHeader(HeaderConstants.HEADER_CONTENT_LENGTH, "0", headers);
} else if (entity.getAvailableSize() != Representation.UNKNOWN_SIZE) {
addHeader(HeaderConstants.HEADER_CONTENT_LENGTH,
Long.toString(entity.getAvailableSize()), headers);
}
if (entity != null) {
addHeader(HeaderConstants.HEADER_CONTENT_ENCODING,
EncodingWriter.write(entity.getEncodings()), headers);
addHeader(HeaderConstants.HEADER_CONTENT_LANGUAGE,
LanguageWriter.write(entity.getLanguages()), headers);
if (entity.getLocationRef() != null) {
addHeader(HeaderConstants.HEADER_CONTENT_LOCATION, entity
.getLocationRef().getTargetRef().toString(), headers);
}
if (entity.getDigest() != null
&& Digest.ALGORITHM_MD5.equals(entity.getDigest()
.getAlgorithm())) {
addHeader(
HeaderConstants.HEADER_CONTENT_MD5,
new String(org.restlet.engine.util.Base64.encode(entity
.getDigest().getValue(), false)),
headers);
}
if (entity.getRange() != null) {
Range range = entity.getRange();
if (isBytesRange(range)) {
addHeader(HeaderConstants.HEADER_CONTENT_RANGE,
RangeWriter.write(range, entity.getSize()),
headers);
} else {
addHeader(HeaderConstants.HEADER_CONTENT_RANGE,
RangeWriter.write(range, range.getInstanceSize()),
headers);
}
}
if (entity.getMediaType() != null) {
addHeader(HeaderConstants.HEADER_CONTENT_TYPE,
ContentType.writeHeader(entity), headers);
}
if (entity.getExpirationDate() != null) {
addHeader(HeaderConstants.HEADER_EXPIRES,
DateWriter.write(entity.getExpirationDate()), headers);
}
if (entity.getModificationDate() != null) {
addHeader(HeaderConstants.HEADER_LAST_MODIFIED,
DateWriter.write(entity.getModificationDate()), headers);
}
if (entity.getTag() != null) {
addHeader(HeaderConstants.HEADER_ETAG,
TagWriter.write(entity.getTag()), headers);
}
if (entity.getDisposition() != null
&& !Disposition.TYPE_NONE.equals(entity.getDisposition()
.getType())) {
addHeader(HeaderConstants.HEADER_CONTENT_DISPOSITION,
DispositionWriter.write(entity.getDisposition()),
headers);
}
}
}
示例2: getExpirationDateAsString
import org.restlet.representation.Representation; //導入方法依賴的package包/類
private Object getExpirationDateAsString(Representation entity) {
return (entity != null && entity.getExpirationDate() != null) ?
DateUtils.format(entity.getExpirationDate(), FORMAT_RFC_1123.get(0)) :
null;
}