Class ValidatingCachingHttpContentFactory

java.lang.Object
org.eclipse.jetty.http.content.CachingHttpContentFactory
org.eclipse.jetty.http.content.ValidatingCachingHttpContentFactory
All Implemented Interfaces:
Runnable, HttpContent.Factory

public class ValidatingCachingHttpContentFactory extends CachingHttpContentFactory implements Runnable

HttpContent.Factory implementation of CachingHttpContentFactory which evicts invalid entries from the cache. Uses a validationTime parameter to check files when they are accessed and/or sweepDelay parameter for a periodic sweep for invalid entries in the cache.

HttpContent validation checks are configured through the validationTime parameter in the constructor. If an HttpContent is found to be invalid it will be removed from the cache. A value of -1 means that the cached HttpContent will never be checked if it is still valid, a value of 0 means it is checked on every request, a positive value indicates the number of milliseconds of the minimum time between validation checks.

This also remember a missed entry for the time set by validationTimems. After this has elapsed the entry will be invalid and will be evicted from the cache at the next access.

  • Constructor Details

    • ValidatingCachingHttpContentFactory

      public ValidatingCachingHttpContentFactory(@Name("authority") HttpContent.Factory authority, @Name("validationPeriod") long validationPeriod, @Name("bufferPool") org.eclipse.jetty.io.ByteBufferPool bufferPool)
      Construct a ValidatingCachingHttpContentFactory which validates entries upon use to check if they are still valid.
      Parameters:
      authority - the wrapped HttpContent.Factory to use.
      validationPeriod - time between filesystem checks in ms to see if an HttpContent is still valid (-1 never validate, 0 always validate).
      bufferPool - the ByteBufferPool to use.
    • ValidatingCachingHttpContentFactory

      public ValidatingCachingHttpContentFactory(@Name("authority") HttpContent.Factory authority, @Name("validationPeriod") long validationPeriod, @Name("byteBufferPool") org.eclipse.jetty.io.ByteBufferPool bufferPool, @Name("scheduler") org.eclipse.jetty.util.thread.Scheduler scheduler, @Name("sweepPeriod") long sweepPeriod, @Name("idleTimeout") long idleTimeout)
      Construct a ValidatingCachingHttpContentFactory which validates entries upon use to check if they are still valid and an optional period sweeper of the cache to find invalid and old entries to evict.
      Parameters:
      authority - the wrapped HttpContent.Factory to use.
      validationPeriod - time between filesystem checks in ms to see if an HttpContent is still valid (-1 never validate, 0 always validate).
      bufferPool - the ByteBufferPool to use.
      scheduler - scheduler to use for the sweeper, can be null to not use sweeper.
      sweepPeriod - time between runs of the sweeper in ms (if 0 never sweep for invalid entries).
      idleTimeout - amount of time in ms an entry can be unused before evicted by the sweeper (if 0 never evict unused entries).
  • Method Details