Class BrowserPolicy

java.lang.Object
overit.geocall.servlet.gate.BrowserPolicy
All Implemented Interfaces:
Serializable

public class BrowserPolicy extends Object implements Serializable
This class defines the browser policy, in particular it defines the management characteristics that the browser must keep in comparison with the Source it will download
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BrowserPolicy(int downloadDuration, boolean entityValidation)
    It defines the management characteristics that the browser must keep in comparison with the Source it will download.
  • Method Summary

    Modifier and Type
    Method
    Description
    Format the management characteristics
    trasforms the download duration in a standard Cache-Control http header with private, must-revalidate and max-age atributes
    int
    Returns the download duration (that is the number of seconds the browser can afford to cache the resource, without re-querying the server)
    boolean
    Returns the entity validation (that allows to activate the validation of entities through ETag, thanks to which, after the duration of the cache, the server may respond 307, avoiding the download of the resource, as it hasn't changed)
    Parse the BrowserPolicy

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _downloadDuration

      protected int _downloadDuration
    • _entityValidation

      protected boolean _entityValidation
  • Constructor Details

    • BrowserPolicy

      public BrowserPolicy(int downloadDuration, boolean entityValidation)
      It defines the management characteristics that the browser must keep in comparison with the Source it will download.
      Parameters:
      downloadDuration - is the number of seconds the browser can afford to cache the resource, without re-querying the server. Obviously this applies to the identification of the resource which therefore includes the recovery coordinates (windowmanager,finestra, ecc).
      entityValidation - allows to activate the validation of entities through ETag, thanks to which, after the duration of the cache, the server may respond 307, avoiding the download of the resource, as it hasn't changed. Prerequisite to activate this mechanism is that the Source implements the getEntityTag
  • Method Details

    • parse

      public static BrowserPolicy parse(String bp)
      Parse the BrowserPolicy
      Parameters:
      bp - String to parse
      Returns:
      The BrowserPolicy
    • getDownloadDuration

      public int getDownloadDuration()
      Returns the download duration (that is the number of seconds the browser can afford to cache the resource, without re-querying the server)
      Returns:
      The download duration
    • getCacheControl

      public String getCacheControl()
      trasforms the download duration in a standard Cache-Control http header with private, must-revalidate and max-age atributes
      Returns:
      the download duration http header equivalent
    • getEntityValidation

      public boolean getEntityValidation()
      Returns the entity validation (that allows to activate the validation of entities through ETag, thanks to which, after the duration of the cache, the server may respond 307, avoiding the download of the resource, as it hasn't changed)
      Returns:
      The entity validation
    • format

      public String format()
      Format the management characteristics
      Returns:
      The string containing the management characteristics