Package overit.geocall.servlet.gate
Class BrowserPolicy
java.lang.Object
overit.geocall.servlet.gate.BrowserPolicy
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected intprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionBrowserPolicy(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 TypeMethodDescriptionformat()Format the management characteristicstrasforms the download duration in a standard Cache-Control http header with private, must-revalidate and max-age atributesintReturns the download duration (that is the number of seconds the browser can afford to cache the resource, without re-querying the server)booleanReturns 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)static BrowserPolicyParse the BrowserPolicy
-
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
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
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
Format the management characteristics- Returns:
- The string containing the management characteristics
-