public class CachingDynamicContentImpl extends Content.Adapter implements DynamicContent
This class also keeps track of the most recent times the object's template was used to generate content that was different from the result of the previous generation using this template. This information is used in responding to HTTP HEAD requests. Java Web Start uses HEAD requests to find out if a document on the server is more recent than the locally cached copy on the client. If so, then Java Web Start will request the updated version with a routine GET request.
To avoid incorrectly reporting obsolete cached documents as current, this class keeps track of when the content generated by the template is different from the previous generation.
The generated content can depend on request-time information (such as command line arguments passed in the query string of the HTTP request). We save and track only a few individual response instances, because the assumption is that requests that carry query strings (which are converted into command line arguments passed to ACC and on through to the app client) are likely to change frequently and not necessarily be reused often. Keeping a few allows caching the different content resulting from a small number of different argument value settings, but avoids the problems of caching every single response which could become a large memory drain if each request specified a different set of arguments (for instance, one of the arguments could be a timestamp that would change every time).
DynamicContent.Instance, DynamicContent.InstanceAdapterContent.Adapter, Content.State| Modifier and Type | Field and Description |
|---|---|
protected String |
mimeType
the MIME type of the data represented by this CachingDynamicContentImpl instance
|
| Constructor and Description |
|---|
CachingDynamicContentImpl(String template,
String mimeType)
Returns a new instance of CachingDynamicContentImpl.
|
CachingDynamicContentImpl(String template,
String mimeType,
int maxInstances) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearInstances()
Clears the cached instances.
|
boolean |
equals(Object obj) |
DynamicContent.Instance |
getExistingInstance(Properties tokenValues)
Returns the CachingDynamicContentImpl.InstanceImpl for this template corresponding to
the specified substitution token values.
|
String |
getMimeType()
Returns the MIME type associated with this content.
|
DynamicContent.Instance |
getOrCreateInstance(Properties tokenValues)
Retrieves an existing "instance" of this dynamic content, with placeholders
substituted, creating a new one if none already exists.
|
int |
hashCode() |
boolean |
isMain()
Reports whether this dynamic content represents the main JNLP document
for an app client.
|
String |
toString()
Returns a string representation of the CachingDynamicContentImpl.
|
isAvailable, resume, start, state, stop, suspendprotected final String mimeType
public CachingDynamicContentImpl(String template, String mimeType)
origin - the ContentOrigin for the new content instancecontentKey - the content key used to store and retrieve the contentpath - the path relative to the subcategory in which this document is addressablemimeType - the MIME type of data represented by the content generated by this
object.public DynamicContent.Instance getExistingInstance(Properties tokenValues)
getExistingInstance in interface DynamicContenttokenValues - the name/value pairs to be substituted in the templatecreateIfAbsent - selects whether a new CachingDynamicContentImpl.InstanceImpl should
be created for the resulting text if the content text resulting from the
substitution is not already cached by this CachingDynamicContentImpl.public DynamicContent.Instance getOrCreateInstance(Properties tokenValues)
DynamicContentgetOrCreateInstance in interface DynamicContenttokenValues - maps placeholder tokens to valuespublic boolean isMain()
DynamicContentisMain in interface DynamicContentpublic String getMimeType()
getMimeType in interface DynamicContentprotected void clearInstances()
public String toString()
Copyright © 2019. All rights reserved.