public static Result fromFile ( File file , Context context , ApplicationConfiguration configuration , Crypto crypto ) { long lastModified = file . lastModified ( ) ; String etag = computeEtag ( lastModified , configuration , crypto ) ; if ( isNotModified ( context , lastModified , etag ) ) { return new Result ( Status . NOT_MODIFIED ) ; } else { Result result = Results . ok ( file ) ; addLastModified ( result , lastModified ) ; addCacheControlAndEtagToResult ( result , etag , configuration ) ; return result ; } }
Computes the result to sent the given file . Cache headers are automatically set by this method .