Example #1
0
 @Override
 public Date getLastModified() {
   Object d = metadata.getFirst(HttpHeaders.LAST_MODIFIED);
   if (d == null) return null;
   if (d instanceof Date) return (Date) d;
   return DateUtil.parseDate(d.toString());
 }
Example #2
0
 @Override
 public Date getDate() {
   Object d = metadata.getFirst(HttpHeaders.DATE);
   if (d == null) return null;
   if (d instanceof Date) return (Date) d;
   return DateUtil.parseDate(d.toString());
 }
Example #3
0
 @Override
 public EntityTag getEntityTag() {
   Object d = metadata.getFirst(HttpHeaders.ETAG);
   if (d == null) return null;
   if (d instanceof EntityTag) return (EntityTag) d;
   return EntityTag.valueOf(getHeaderValueProcessor().toHeaderString(d));
 }
Example #4
0
 @Override
 public MediaType getMediaType() {
   Object obj = metadata.getFirst(HttpHeaders.CONTENT_TYPE);
   if (obj instanceof MediaType) return (MediaType) obj;
   if (obj == null) return null;
   return MediaType.valueOf(getHeaderValueProcessor().toHeaderString(obj));
 }
Example #5
0
 @Override
 public int getLength() {
   Object obj = metadata.getFirst(HttpHeaders.CONTENT_LANGUAGE);
   if (obj == null) return -1;
   if (obj instanceof Integer) return (Integer) obj;
   return Integer.valueOf(getHeaderValueProcessor().toHeaderString(obj));
 }
Example #6
0
 @Override
 public Locale getLanguage() {
   Object obj = metadata.getFirst(HttpHeaders.CONTENT_LANGUAGE);
   if (obj == null) return null;
   if (obj instanceof Locale) return (Locale) obj;
   return new Locale(obj.toString());
 }
Example #7
0
 @Override
 public URI getLocation() {
   Object uri = metadata.getFirst(HttpHeaders.LOCATION);
   if (uri == null) return null;
   if (uri instanceof URI) return (URI) uri;
   String str = null;
   if (uri instanceof String) str = (String) uri;
   else str = getHeaderValueProcessor().toHeaderString(uri);
   return URI.create(str);
 }