{
// Check command rules
Date modificationDate = request.getConditions().getUnmodifiedSince();
if( modificationDate != null )
{
EntityState state = spi.entityStateOf( entity );
Date lastModified = new Date( ( state.lastModified() / 1000 ) * 1000 ); // Cut off milliseconds
if( lastModified.after( modificationDate ) )
{
throw new ResourceException( Status.CLIENT_ERROR_CONFLICT );
}
}
// Check query rules
modificationDate = request.getConditions().getModifiedSince();
if( modificationDate != null )
{
EntityState state = spi.entityStateOf( entity );
Date lastModified = new Date( ( state.lastModified() / 1000 ) * 1000 ); // Cut off milliseconds
if( !lastModified.after( modificationDate ) )
{
throw new ResourceException( Status.REDIRECTION_NOT_MODIFIED );
}
}