protected boolean passConditionalHeaders(HttpServletRequest request, HttpServletResponse response, Resource resource) throws IOException
    {
        if (!request.getMethod().equals(HttpRequest.__HEAD) && request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI) == null)
        {
            // If we have meta data for the file
            // Try a direct match for most common requests. Avoids
            // parsing the date.
            ResourceCache.ResourceMetaData metaData = _httpContext.getResourceMetaData(resource);
            if (metaData != null)
            {
                String ifms = request.getHeader(HttpFields.__IfModifiedSince);
                String mdlm = metaData.getLastModified();
                if (ifms != null && mdlm != null && ifms.equals(mdlm))
                {
                    response.reset();
                    response.setStatus(HttpResponse.__304_Not_Modified);
                    response.flushBuffer();
                    return false;
                }
            }

            long date = 0;
            // Parse the if[un]modified dates and compare to resource

            if ((date = request.getDateHeader(HttpFields.__IfUnmodifiedSince)) > 0)
            {
                if (resource.lastModified() / 1000 > date / 1000)
                {
                    response.sendError(HttpResponse.__412_Precondition_Failed);
                    return false;
                }
            }

            if ((date = request.getDateHeader(HttpFields.__IfModifiedSince)) > 0)
            {
                if (resource.lastModified() / 1000 <= date / 1000)
                {
                    response.reset();
                    response.setStatus(HttpResponse.__304_Not_Modified);
                    response.flushBuffer();
                    return false;
                }
            }
        }
        return true;
    }
protected boolean passConditionalHeaders ( HttpServletRequest request , HttpServletResponse response , Resource resource ) throws IOException { if ( ! request . getMethod ( ) . equals ( HttpRequest . __HEAD ) && request . getAttribute ( Dispatcher . __INCLUDE_REQUEST_URI ) == null ) { ResourceCache . ResourceMetaData metaData = _httpContext . getResourceMetaData ( resource ) ; if ( metaData != null ) { String ifms = request . getHeader ( HttpFields . __IfModifiedSince ) ; String mdlm = metaData . getLastModified ( ) ; if ( ifms != null && mdlm != null && ifms . equals ( mdlm ) ) { response . reset ( ) ; response . setStatus ( HttpResponse . __304_Not_Modified ) ; response . flushBuffer ( ) ; return false ; } } long date = 0 ; if ( ( date = request . getDateHeader ( HttpFields . __IfUnmodifiedSince ) ) > 0 ) { if ( resource . lastModified ( ) / 1000 > date / 1000 ) { response . sendError ( HttpResponse . __412_Precondition_Failed ) ; return false ; } } if ( ( date = request . getDateHeader ( HttpFields . __IfModifiedSince ) ) > 0 ) { if ( resource . lastModified ( ) / 1000 <= date / 1000 ) { response . reset ( ) ; response . setStatus ( HttpResponse . __304_Not_Modified ) ; response . flushBuffer ( ) ; return false ; } } } return true ; }
/*
Check modification date headers.