|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.markup.MarkupCache
public class MarkupCache
This is Wicket's default IMarkupCache implementation. It will load the markup and cache it for fast retrieval.
If the application is in development mode and a markup file changes, it'll automatically be removed from the cache and reloaded when needed.
MarkupCache is registered with IMarkupSettings
and thus can be replaced with a subclassed
version.
IMarkupSettings
Nested Class Summary | |
---|---|
class |
MarkupCache.DefaultCacheImplementation<K,V>
|
static interface |
MarkupCache.ICache<K,V>
MarkupCache allows you to implement you own cache implementation. |
Constructor Summary | |
---|---|
MarkupCache(Application application)
Constructor. |
Method Summary | ||
---|---|---|
void |
clear()
Clear markup cache and force reload of all markup data |
|
Markup |
getMarkup(MarkupContainer container,
java.lang.Class<?> clazz,
boolean enforceReload)
THIS IS NOT PART OF WICKET'S PUBLIC API. |
|
protected MarkupCache.ICache<java.lang.CharSequence,Markup> |
getMarkupCache()
Get a unmodifiable map which contains the cached data. |
|
IMarkupCacheKeyProvider |
getMarkupCacheKeyProvider(MarkupContainer container)
Get the markup cache key provider to be used |
|
protected Markup |
getMarkupFromCache(java.lang.CharSequence cacheKey,
MarkupContainer container)
Wicket's default implementation just uses the cacheKey to retrieve the markup from the cache. |
|
protected IMarkupLoader |
getMarkupLoader()
In case there is a need to extend the default chain of MarkupLoaders |
|
protected IMarkupResourceStreamProvider |
getMarkupResourceStreamProvider(MarkupContainer container)
Get the markup resource stream provider to be used |
|
MarkupStream |
getMarkupStream(MarkupContainer container,
boolean enforceReload,
boolean throwException)
Gets a fresh markup stream that contains the (immutable) markup resource for this class. |
|
boolean |
hasAssociatedMarkup(MarkupContainer container)
Check if container has associated markup |
|
protected
|
newCacheImplementation()
Allows you to change the map implementation which will hold the cache data. |
|
protected Markup |
onMarkupNotFound(java.lang.String cacheKey,
MarkupContainer container)
Will be called if the markup was not in the cache yet but could not be found either. |
|
protected Markup |
putIntoCache(java.lang.String locationString,
Markup markup)
Deprecated. see putIntoCache(String, MarkupContainer, Markup) |
|
protected Markup |
putIntoCache(java.lang.String locationString,
MarkupContainer container,
Markup markup)
Put the markup into the cache if cacheKey is not null and the cache does not yet contain the cacheKey. |
|
Markup |
removeMarkup(java.lang.String cacheKey)
Remove the markup associated with the cache key from the cache including all dependent markups (markup inheritance) |
|
void |
shutdown()
Will be called by the application while shutting down. |
|
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarkupCache(Application application)
application
- Method Detail |
---|
public final void clear()
IMarkupCache
clear
in interface IMarkupCache
IMarkupCache.clear()
public void shutdown()
IMarkupCache
shutdown
in interface IMarkupCache
IMarkupCache.shutdown()
public final Markup removeMarkup(java.lang.String cacheKey)
IMarkupCache
removeMarkup
in interface IMarkupCache
IMarkupCache.removeMarkup(java.lang.String)
public final MarkupStream getMarkupStream(MarkupContainer container, boolean enforceReload, boolean throwException)
IMarkupCache
getMarkupStream
in interface IMarkupCache
container
- The container the markup should be associated withenforceReload
- The cache will be ignored and all, including inherited markup files, will be
reloaded. Whatever is in the cache, it will be ignoredthrowException
- If true, throw an exception, if markup could not be found
IMarkupCache.getMarkupStream(org.apache.wicket.MarkupContainer,
boolean, boolean)
public final boolean hasAssociatedMarkup(MarkupContainer container)
IMarkupCache
hasAssociatedMarkup
in interface IMarkupCache
container
- The container the markup should be associated with
IMarkupCache.hasAssociatedMarkup(org.apache.wicket.MarkupContainer)
public final int size()
size
in interface IMarkupCache
IMarkupCache.size()
protected final MarkupCache.ICache<java.lang.CharSequence,Markup> getMarkupCache()
public final Markup getMarkup(MarkupContainer container, java.lang.Class<?> clazz, boolean enforceReload)
getMarkup
in interface IMarkupCache
container
- The original requesting markup containerclazz
- The class to get the associated markup for. If null, the container's class is
used, but it can be a parent class of the container as well (markup inheritance)enforceReload
- The cache will be ignored and all, including inherited markup files, will be
reloaded. Whatever is in the cache, it will be ignored
IMarkupCache.getMarkup(org.apache.wicket.MarkupContainer,
java.lang.Class, boolean)
protected Markup onMarkupNotFound(java.lang.String cacheKey, MarkupContainer container)
Subclasses may change the default implementation. E.g. they might choose not update the cache to enforce reloading of any markup not found. This might be useful in very dynamic environments.
cacheKey
- container
-
@Deprecated protected Markup putIntoCache(java.lang.String locationString, Markup markup)
putIntoCache(String, MarkupContainer, Markup)
locationString
- If null, than ignore the cachemarkup
-
protected Markup putIntoCache(java.lang.String locationString, MarkupContainer container, Markup markup)
locationString
- If null, than ignore the cachecontainer
- The container this markup is for.markup
-
protected Markup getMarkupFromCache(java.lang.CharSequence cacheKey, MarkupContainer container)
cacheKey
- If null, than the cache will be ignoredcontainer
-
public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container)
container
- The MarkupContainer requesting the markup resource stream
protected IMarkupResourceStreamProvider getMarkupResourceStreamProvider(MarkupContainer container)
container
- The MarkupContainer requesting the markup resource stream
protected IMarkupLoader getMarkupLoader()
protected <K,V> MarkupCache.ICache<K,V> newCacheImplementation()
K
- V
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |