@Override public void setTag(Tag tag) { getWrappedRepresentation().setTag(tag); }
private Representation entityHeaders( Representation representation, EntityState entityState ) { representation.setModificationDate( java.util.Date.from( entityState.lastModified() ) ); representation.setTag( new Tag( "" + entityState.version() ) ); representation.setCharacterSet( CharacterSet.UTF_8 ); representation.setLanguages( Collections.singletonList( Language.ENGLISH ) ); return representation; }
@Get public Representation represent() { // Modification date (Fri, 17 Apr 2012 10:10:10 GMT) unchanged. Calendar cal = new GregorianCalendar(2012, 4, 17, 10, 10, 10); Representation result = new StringRepresentation("<a href=" + getReference() + ">" + System.currentTimeMillis() + "</a>"); result.setMediaType(MediaType.TEXT_HTML); result.setModificationDate(cal.getTime()); // Expiration date (Fri, 17 Apr 2012 13:10:10 GMT) unchanged. cal.roll(Calendar.HOUR, 3); result.setExpirationDate(cal.getTime()); // Setting E-Tag result.setTag(new Tag("xyz123")); // Setting a cache directive getResponse().getCacheDirectives().add(CacheDirective.publicInfo()); return result; }
void updateResponse( Response response ) { if( entity != null ) { EntityState state = spi.entityStateOf( entity ); Tag tag = new Tag( state.entityReference().identity() + "/" + state.version() ); response.getEntity().setModificationDate( java.util.Date.from( state.lastModified() ) ); response.getEntity().setTag( tag ); } }
void updateResponse( Response response ) { if( entity != null ) { EntityState state = spi.entityStateOf( entity ); Tag tag = new Tag( state.entityReference().identity() + "/" + state.version() ); response.getEntity().setModificationDate( java.util.Date.from( state.lastModified() ) ); response.getEntity().setTag( tag ); } }
public void updateResponse( Response response ) { if( entity != null ) { EntityState state = spi.entityStateOf( entity ); Date lastModified = new Date( state.lastModified() ); Tag tag = new Tag( state.identity().identity() + "/" + state.version() ); response.getEntity().setModificationDate( lastModified ); response.getEntity().setTag( tag ); } }
/** * Constructor from a variant. * * @param variant * The variant to copy. * @param modificationDate * The modification date. * @param tag * The tag. */ public Representation(Variant variant, Date modificationDate, Tag tag) { setCharacterSet(variant.getCharacterSet()); setEncodings(variant.getEncodings()); setLocationRef(variant.getLocationRef()); setLanguages(variant.getLanguages()); setMediaType(variant.getMediaType()); setModificationDate(modificationDate); setTag(tag); }
entityHeaderFound = true; } else if (HEADER_ETAG.equalsIgnoreCase(header.getName())) { result.setTag(Tag.parse(header.getValue())); entityHeaderFound = true; } else if (HEADER_CONTENT_LOCATION.equalsIgnoreCase(header.getName())) {