protected boolean needsToBeRefreshed(DefaultFacelet facelet)
    {
        // if set to 0, constantly reload-- nocache
        if (_refreshPeriod == NO_CACHE_DELAY)
        {
            return true;
        }

        // if set to -1, never reload
        if (_refreshPeriod == INFINITE_DELAY)
        {
            return false;
        }

        long target = facelet.getCreateTime() + _refreshPeriod;
        if (System.currentTimeMillis() > target)
        {
            // Should check for file modification

            URLConnection conn = null;
            try
            {
                conn = facelet.getSource().openConnection();
                long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);

                return lastModified == 0 || lastModified > target;
            }
            catch (IOException e)
            {
                throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
            }
            finally
            {
                // finally close input stream when finished, if fails just continue.
                if (conn != null)
                {
                    try 
                    {
                        InputStream is = conn.getInputStream();
                        if (is != null)
                        {
                            is.close();
                        }
                    }
                    catch (IOException e)
                    {
                        // Ignore 
                    }
                }
            }
        }

        return false;
    }
protected boolean needsToBeRefreshed ( DefaultFacelet facelet ) { if ( _refreshPeriod == NO_CACHE_DELAY ) { return true ; } if ( _refreshPeriod == INFINITE_DELAY ) { return false ; } long target = facelet . getCreateTime ( ) + _refreshPeriod ; if ( System . currentTimeMillis ( ) > target ) { URLConnection conn = null ; try { conn = facelet . getSource ( ) . openConnection ( ) ; long lastModified = ResourceLoaderUtils . getResourceLastModified ( conn ) ; return lastModified == 0 || lastModified > target ; } catch ( IOException e ) { throw new FaceletException ( "Error Checking Last Modified for " + facelet . getAlias ( ) , e ) ; } finally { if ( conn != null ) { try { InputStream is = conn . getInputStream ( ) ; if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { } } } } return false ; }
Template method for determining if the Facelet needs to be refreshed.

@param facelet
Facelet that could have expired
@return true if it needs to be refreshed