/** * Returns the modification time. * * @param templateSource * The template source {@link Representation}. * @return The modification time. */ public long getLastModified(Object templateSource) { Date lastModified = ((Representation) templateSource) .getModificationDate(); return (lastModified == null) ? -1L : lastModified.getTime(); }
private Object getModificationDateAsString(Representation entity) { return (entity != null && (entity.getModificationDate() != null)) ? DateUtils.format(entity.getModificationDate(), FORMAT_RFC_1123.get(0)) : null; }
@Override public Date getModificationDate() { return getWrappedRepresentation().getModificationDate(); }
@Override public long getLastModified(Resource resource) { final Representation original = getStore().get(resource.getName()); return (original != null) ? original.getModificationDate().getTime() : 0; }
public static void main(String[] args) throws Exception { ClientResource resource = new ClientResource("http://localhost:8111/"); // Get a representation Representation rep = resource.get(); // Display caching metadata System.out.println("Modified: " + rep.getModificationDate()); System.out.println("Expires: " + rep.getExpirationDate()); System.out.println("E-Tag: " + rep.getTag()); } }
if (entity != null && !entryName.endsWith("/")) { ZipEntry entry = new ZipEntry(entryName); if (entity.getModificationDate() != null) entry.setTime(entity.getModificationDate().getTime()); else { entry.setTime(System.currentTimeMillis());
/** * Constructor based on a Velocity 'encoded' representation. * * @param templateRepresentation * The representation to 'decode'. * @param mediaType * The representation's media type. * @throws IOException * @throws ParseErrorException * @throws ResourceNotFoundException */ public TemplateRepresentation(Representation templateRepresentation, MediaType mediaType) throws ResourceNotFoundException, ParseErrorException, IOException { super(mediaType); this.engine = null; this.template = new Template(); CharacterSet charSet = (templateRepresentation.getCharacterSet() != null) ? templateRepresentation .getCharacterSet() : CharacterSet.DEFAULT; this.template.setEncoding(charSet.getName()); this.template.setLastModified((templateRepresentation .getModificationDate() == null) ? new Date().getTime() : templateRepresentation.getModificationDate().getTime()); this.template.setName("org.restlet.resource.representation"); this.template.setRuntimeServices(RuntimeSingleton.getRuntimeServices()); this.template.setResourceLoader(new RepresentationResourceLoader( templateRepresentation)); this.template.process(); this.templateName = null; }
CacheInfo value = new CacheInfo( response.getEntity().getModificationDate().toInstant(), tag); identityToTimestamp.put( value.getEntity(), value );
resource.getConditions().setModifiedSince(rep.getModificationDate()); rep = resource.get(); System.out.println(resource.getStatus());
this.template.setEncoding(charSet.getName()); if (templateRepresentation.getModificationDate() != null) { this.template.setLastModified(templateRepresentation .getModificationDate().getTime());
if (this.representation.getModificationDate() != null) { getMetadata().set( HttpHeaders.LAST_MODIFIED, DateUtils.format(this.representation .getModificationDate()));
if( response.getEntity().getModificationDate() == null )
if( response.getEntity().getModificationDate() == null )
if( response.getEntity().getModificationDate() == null )
if (entity.getModificationDate() != null) { addHeader(HEADER_LAST_MODIFIED, DateWriter.write(entity.getModificationDate()), headers);