* @throws PAPIException If there was a problem setting the cache expiry.
*/
private void applyCacheExpires(
MarinerRequestContext context, String content)
throws PAPIException {
final ResponseCachingDirectives cachingDirectives =
getCachingDirectives(context);
if (cachingDirectives != null) {
// Determine cache expiry as Time
try {
Date httpDate = HttpDateParser.parse(content);
if (httpDate == null) {
// If string didn't parse to long property, throw an exception
// reusing existing localised message, saying that Time was
// expected, but String was encountered.
throw new PAPIException(EXCEPTION_LOCALIZER.format(
"invalid-meta-content-type", new Object[]{
Time.class.getName(), String.class.getName()}));
}
Time expires = Time.inMilliSeconds(httpDate.getTime());
cachingDirectives.setExpires(expires,
ResponseCachingDirectives.PRIORITY_HIGH);
cachingDirectives.enable();
} catch (NumberFormatException e) {
}
}
}