## org.mozilla.javascript.commonjs.module.provider
Class DefaultUrlConnectionExpiryCalculator

    java.lang.Object
      org.mozilla.javascript.commonjs.module.provider.DefaultUrlConnectionExpiryCalculator

All Implemented Interfaces:
  java.io.Serializable, UrlConnectionExpiryCalculator

    public class DefaultUrlConnectionExpiryCalculator

extends java.lang.Object
implements UrlConnectionExpiryCalculator, java.io.Serializable

The default heuristic for calculating cache expiry of URL-based resources. It is simply configured with a default relative expiry, and each invocation of `calculateExpiry(URLConnection)` returns `System.currentTimeMillis()` incremented with the relative expiry.

Version:
  $Id: DefaultUrlConnectionExpiryCalculator.java,v 1.3 2011/04/07 20:26:12 hannes%helma.at Exp $
Author:
  Attila Szegedi
See Also:
  Serialized Form

Constructor Summary
`DefaultUrlConnectionExpiryCalculator()` Creates a new default expiry calculator with one minute relative expiry.
`DefaultUrlConnectionExpiryCalculator(long relativeExpiry)` Creates a new default expiry calculator with the specified relative expiry.

Method Summary
`long` `calculateExpiry(java.net.URLConnection urlConnection)` Given a URL connection, returns a calculated heuristic expiry time (in terms of milliseconds since epoch) for the resource.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultUrlConnectionExpiryCalculator

    public DefaultUrlConnectionExpiryCalculator()

  Creates a new default expiry calculator with one minute relative expiry.

### DefaultUrlConnectionExpiryCalculator

    public DefaultUrlConnectionExpiryCalculator(long relativeExpiry)

  Creates a new default expiry calculator with the specified relative expiry.

  Parameters:
    `relativeExpiry` - the fixed relative expiry, in milliseconds.

Method Detail

### calculateExpiry

    public long calculateExpiry(java.net.URLConnection urlConnection)

  Description copied from interface: `UrlConnectionExpiryCalculator`
  Given a URL connection, returns a calculated heuristic expiry time (in terms of milliseconds since epoch) for the resource.

  Specified by:
    `calculateExpiry` in interface `UrlConnectionExpiryCalculator`
  Parameters:
    `urlConnection` - the URL connection for the resource
  Returns:
    the expiry for the resource