private boolean maybeStream(Path p,HttpServletRequest req,HttpServletResponse rsp) throws IOException {
  try {
    if (Files.size(p) < cacheFileSizeLimitBytes) {
      return false;
    }
  }
 catch (  NoSuchFileException e) {
    cache.put(p,Resource.NOT_FOUND);
    notFound(rsp);
    return true;
  }
  long lastModified=FileUtil.lastModified(p);
  if (req.getDateHeader(IF_MODIFIED_SINCE) >= lastModified) {
    rsp.setStatus(SC_NOT_MODIFIED);
    return true;
  }
  if (lastModified > 0) {
    rsp.setDateHeader(LAST_MODIFIED,lastModified);
  }
  if (!CacheHeaders.hasCacheHeader(rsp)) {
    CacheHeaders.setCacheable(req,rsp,15,MINUTES,refresh);
  }
  rsp.setContentType(contentType(p.toString()));
  OutputStream out=rsp.getOutputStream();
  GZIPOutputStream gz=null;
  if (RPCServletUtils.acceptsGzipEncoding(req)) {
    rsp.setHeader(CONTENT_ENCODING,"gzip");
    gz=new GZIPOutputStream(out);
    out=gz;
  }
  Files.copy(p,out);
  if (gz != null) {
    gz.finish();
  }
  return true;
}

private boolean maybeStream ( Path p , HttpServletRequest req , HttpServletResponse rsp ) throws IOException { try { if ( Files . size ( p ) < cacheFileSizeLimitBytes ) { return false ; } } catch ( NoSuchFileException e ) { cache . put ( p , Resource . NOT_FOUND ) ; notFound ( rsp ) ; return true ; } long lastModified = FileUtil . lastModified ( p ) ; if ( req . getDateHeader ( IF_MODIFIED_SINCE ) >= lastModified ) { rsp . setStatus ( SC_NOT_MODIFIED ) ; return true ; } if ( lastModified > 0 ) { rsp . setDateHeader ( LAST_MODIFIED , lastModified ) ; } if ( ! CacheHeaders . hasCacheHeader ( rsp ) ) { CacheHeaders . setCacheable ( req , rsp , 15 , MINUTES , refresh ) ; } rsp . setContentType ( contentType ( p . toString ( ) ) ) ; OutputStream out = rsp . getOutputStream ( ) ; GZIPOutputStream gz = null ; if ( RPCServletUtils . acceptsGzipEncoding ( req ) ) { rsp . setHeader ( CONTENT_ENCODING , "gzip" ) ; gz = new GZIPOutputStream ( out ) ; out = gz ; } Files . copy ( p , out ) ; if ( gz != null ) { gz . finish ( ) ; } return true ; }
maybe stream a path to the response , depending on the properties of the file and cache headers in the request .
