boolean restHandler = handler instanceof RESTHandler;
boolean httpEndpoint = endpoint instanceof HTTPServerBase;
if ( restHandler && httpEndpoint ) {
Request request = context.getRequest();
Response response = context.getResponse();
RecordMetaData meta = col.getRecordMetaData(tx, key);
if ( meta != null ) {
Long lm = (Long)meta.getValue(RecordMetaData.MODIFIED);
if ( lm != null ) {
String lastModified = GDF.format(new Date(lm.longValue()));
response.setHeader(HTTP.HEADER_CACHE_CONTROL, HTTP.VALUE_CACHE);
response.setHeader(HTTP.HEADER_LAST_MODIFIED, lastModified);
String since = request.getHeader(HTTP.HEADER_IF_MODIFIED_SINCE);
if ( since != null && since.length() > 0 && since.equals(lastModified) )
throw new HTTPException(HTTP.CODE_NOT_MODIFIED, HTTP.STATUS_NOT_MODIFIED);
}
}
}