|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.settings.def.ResourceSettings
public class ResourceSettings
| Constructor Summary | |
|---|---|
ResourceSettings(Application application)
Configures Wicket's default ResourceLoaders. For an example in FooApplication let bar.Foo extend Component, this
results in the following ordering:
component specific
bar/Foo.properties
org/apache/wicket/Component.properties
package specific
bar/package.properties
package.properties (on Foo's class loader)
org/apache/wicket/package.properties
org/apache/package.properties
org/package.properties
package.properties (on Component's class loader)
application specific
FooApplication.properties
Application.properties
validator specific
Initializer specific
bar.Foo.properties (Foo implementing IInitializer)
|
|
| Method Summary | |
|---|---|
void |
addResourceFactory(String name,
IResourceFactory resourceFactory)
Adds a resource factory to the list of factories to consult when generating resources automatically |
IResourceCachingStrategy |
getCachingStrategy()
gets the resource caching strategy |
ICssCompressor |
getCssCompressor()
Get the CSS compressor to remove comments and whitespace characters from css resources |
Duration |
getDefaultCacheDuration()
Get the the default cache duration for resources. |
IFileCleaner |
getFileCleaner()
|
Comparator<? super ResourceAggregator.RecordedHeaderItem> |
getHeaderItemComparator()
|
IJavaScriptCompressor |
getJavaScriptCompressor()
Get the javascript compressor to remove comments and whitespace characters from javascripts |
Localizer |
getLocalizer()
Get the application's localizer. |
IPackageResourceGuard |
getPackageResourceGuard()
Gets the package resource guard. |
String |
getParentFolderPlaceholder()
Placeholder string for '..' within resource urls (which will be crippled by the browser and not work anymore). |
IPropertiesFactory |
getPropertiesFactory()
Get the property factory which will be used to load property files |
IResourceFactory |
getResourceFactory(String name)
|
List<IResourceFinder> |
getResourceFinders()
Gets the resource finders to use when searching for resources. |
Duration |
getResourcePollFrequency()
|
IResourceStreamLocator |
getResourceStreamLocator()
|
IModificationWatcher |
getResourceWatcher(boolean start)
|
List<IStringResourceLoader> |
getStringResourceLoaders()
|
boolean |
getThrowExceptionOnMissingResource()
|
boolean |
getUseDefaultOnMissingResource()
|
boolean |
getUseMinifiedResources()
|
boolean |
isEncodeJSessionId()
A flag indicating whether static resources should have jsessionid encoded in their url. |
void |
setCachingStrategy(IResourceCachingStrategy strategy)
sets the resource caching strategy |
ICssCompressor |
setCssCompressor(ICssCompressor compressor)
Set the CSS compressor implemententation use e.g. |
void |
setDefaultCacheDuration(Duration duration)
Set the the default cache duration for resources. |
void |
setEncodeJSessionId(boolean encodeJSessionId)
Sets a flag indicating whether the jsessionid should be encoded in the url for resources implementing IStaticCacheableResource when
the cookies are disabled and there is an active http session. |
void |
setFileCleaner(IFileCleaner fileUploadCleaner)
Sets a cleaner that can be used to remove files asynchronously. |
void |
setHeaderItemComparator(Comparator<? super ResourceAggregator.RecordedHeaderItem> headerItemComparator)
Sets the comparator used by the resource aggregator for sorting header items. |
IJavaScriptCompressor |
setJavaScriptCompressor(IJavaScriptCompressor compressor)
Set the javascript compressor implemententation use e.g. |
void |
setLocalizer(Localizer localizer)
Sets the localizer which will be used to find property values. |
void |
setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
Sets the package resource guard. |
void |
setParentFolderPlaceholder(String sequence)
Placeholder string for '..' within resource urls (which will be crippled by the browser and not work anymore). |
void |
setPropertiesFactory(IPropertiesFactory factory)
Set the property factory which will be used to load property files |
void |
setResourceFinders(List<IResourceFinder> resourceFinders)
Sets the finders to use when searching for resources. |
void |
setResourcePollFrequency(Duration resourcePollFrequency)
Sets the resource polling frequency. |
void |
setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator)
Sets the resource stream locator for this application |
void |
setResourceWatcher(IModificationWatcher watcher)
Sets the resource watcher |
void |
setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
|
void |
setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
|
void |
setUseMinifiedResources(boolean useMinifiedResources)
Sets whether to use pre-minified resources when available. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceSettings(Application application)
FooApplication let bar.Foo extend Component, this
results in the following ordering:
application - | Method Detail |
|---|
public void addResourceFactory(String name,
IResourceFactory resourceFactory)
IResourceSettings
addResourceFactory in interface IResourceSettingsname - The name to give to the factoryresourceFactory - The resource factory to addIResourceSettings.addResourceFactory(java.lang.String,
org.apache.wicket.IResourceFactory)public Localizer getLocalizer()
IPropertiesFactoryContextIResourceSettings.getStringResourceLoaders().
getLocalizer in interface IPropertiesFactoryContextIPropertiesFactoryContext.getLocalizer()public IPackageResourceGuard getPackageResourceGuard()
IResourceSettingspackage resource guard.
getPackageResourceGuard in interface IResourceSettingsIResourceSettings.getPackageResourceGuard()public IPropertiesFactory getPropertiesFactory()
IResourceSettings
getPropertiesFactory in interface IResourceSettingsIResourceSettings.getPropertiesFactory()public IResourceFactory getResourceFactory(String name)
getResourceFactory in interface IResourceSettingsname - Name of the factory to get
IResourceSettings.getResourceFactory(java.lang.String)public List<IResourceFinder> getResourceFinders()
IResourceSettingsWebApplication adds the classpath
directory META-INF/resources. To configure additional search paths or filesystem paths, add
to this list.
getResourceFinders in interface IResourceSettingsIResourceSettings.getResourceFinders()public Duration getResourcePollFrequency()
getResourcePollFrequency in interface IResourceSettingsIResourceSettings.getResourcePollFrequency()public IResourceStreamLocator getResourceStreamLocator()
getResourceStreamLocator in interface IPropertiesFactoryContextIPropertiesFactoryContext.getResourceStreamLocator()public IModificationWatcher getResourceWatcher(boolean start)
getResourceWatcher in interface IPropertiesFactoryContextstart - boolean if the resource watcher should be started if not already started.
IPropertiesFactoryContext.getResourceWatcher(boolean)public void setResourceWatcher(IModificationWatcher watcher)
IResourceSettings
setResourceWatcher in interface IResourceSettingsIResourceSettings.setResourceWatcher(org.apache.wicket.util.watch.IModificationWatcher)public IFileCleaner getFileCleaner()
getFileCleaner in interface IResourceSettingspublic void setFileCleaner(IFileCleaner fileUploadCleaner)
IResourceSettingsUsed internally to delete the temporary files created by FileUpload functionality
setFileCleaner in interface IResourceSettingsfileUploadCleaner - the actual cleaner implementation. Can be nullpublic List<IStringResourceLoader> getStringResourceLoaders()
getStringResourceLoaders in interface IResourceSettingsIResourceSettings.getStringResourceLoaders()public boolean getThrowExceptionOnMissingResource()
getThrowExceptionOnMissingResource in interface IResourceSettingsIResourceSettings.getThrowExceptionOnMissingResource()public boolean getUseDefaultOnMissingResource()
getUseDefaultOnMissingResource in interface IResourceSettingsIResourceSettings.getUseDefaultOnMissingResource()public void setLocalizer(Localizer localizer)
IResourceSettings
setLocalizer in interface IResourceSettingsIResourceSettings.setLocalizer(org.apache.wicket.Localizer)public void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
IResourceSettingspackage resource guard.
setPackageResourceGuard in interface IResourceSettingspackageResourceGuard - The package resource guardIResourceSettings.setPackageResourceGuard(org.apache.wicket.markup.html.IPackageResourceGuard)public void setPropertiesFactory(IPropertiesFactory factory)
IResourceSettings
setPropertiesFactory in interface IResourceSettingsIResourceSettings.setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory)public void setResourceFinders(List<IResourceFinder> resourceFinders)
IResourceSettingsIResourceSettings.getResourceFinders(). Use this method if you want to completely exchange the list of
resource finders.
setResourceFinders in interface IResourceSettingsresourceFinders - The resourceFinder to setIResourceSettings.setResourceFinders(java.util.List)public void setResourcePollFrequency(Duration resourcePollFrequency)
IResourceSettings
setResourcePollFrequency in interface IResourceSettingsresourcePollFrequency - Frequency at which to poll resources or null if polling should be
disabledIResourceSettings.setResourcePollFrequency(org.apache.wicket.util.time.Duration)public void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator)
resourceStreamLocator in CachingResourceStreamLocator.
This way the locator will not be asked more than once for IResourceStreams which do
not exist.
setResourceStreamLocator in interface IResourceSettingsresourceStreamLocator - new resource stream locatorgetResourceStreamLocator()public void setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
setThrowExceptionOnMissingResource in interface IResourceSettingsIResourceSettings.setThrowExceptionOnMissingResource(boolean)public void setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
setUseDefaultOnMissingResource in interface IResourceSettingsuseDefaultOnMissingResource - Whether to use a default value (if available) when a missing resource is requestedIResourceSettings.setUseDefaultOnMissingResource(boolean)public final Duration getDefaultCacheDuration()
IResourceSettings
getDefaultCacheDuration in interface IResourceSettingsIResourceSettings.getDefaultCacheDuration()public final void setDefaultCacheDuration(Duration duration)
IResourceSettings
setDefaultCacheDuration in interface IResourceSettingsduration - default cache duration in secondsIResourceSettings.setDefaultCacheDuration(org.apache.wicket.util.time.Duration)public IJavaScriptCompressor getJavaScriptCompressor()
IResourceSettings
getJavaScriptCompressor in interface IResourceSettingsJavaScriptPackageResource. Null is a valid value.public IJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor)
IResourceSettingsJavaScriptPackageResource. A typical implementation will remove comments and whitespace. But
a no-op implementation is available as well.
setJavaScriptCompressor in interface IResourceSettingscompressor - The implementation to be used
public ICssCompressor getCssCompressor()
IResourceSettings
getCssCompressor in interface IResourceSettingsCssPackageResource. Null is a valid value.public ICssCompressor setCssCompressor(ICssCompressor compressor)
IResourceSettingsCssPackageResource. A typical
implementation will remove comments and whitespace. But a no-op implementation is available
as well.
setCssCompressor in interface IResourceSettingscompressor - The implementation to be used
public String getParentFolderPlaceholder()
IResourceSettings::. Resources
are protected by a IPackageResourceGuard implementation such as
PackageResourceGuard which you may use or extend based
on your needs.
getParentFolderPlaceholder in interface IResourceSettingsIResourceSettings.getParentFolderPlaceholder()public void setParentFolderPlaceholder(String sequence)
IResourceSettingsnull and thus
will not allow to access parent folders. That is by purpose and for security reasons (see
Wicket-1992). In case you really need it, a good value for placeholder would e.g. be "$up$".
Resources additionally are protected by a
IPackageResourceGuard
implementation such as PackageResourceGuard which you
may use or extend based on your needs.
setParentFolderPlaceholder in interface IResourceSettingssequence - character sequence which must not be ambiguous within urlsIResourceSettings.setParentFolderPlaceholder(String)public IResourceCachingStrategy getCachingStrategy()
IResourceSettings
getCachingStrategy in interface IResourceSettingsIResourceSettings.getCachingStrategy()public void setCachingStrategy(IResourceCachingStrategy strategy)
IResourceSettings
setCachingStrategy in interface IResourceSettingsstrategy - instance of resource caching strategyIResourceSettings.setCachingStrategy(org.apache.wicket.request.resource.caching.IResourceCachingStrategy)public void setUseMinifiedResources(boolean useMinifiedResources)
IResourceSettingsx.js is expected to be called x.min.js. For css
files, the same convention is used: x.min.css is the minified version of
x.css. When this is null, minified resources will only be used in deployment
configuration.
setUseMinifiedResources in interface IResourceSettingsuseMinifiedResources - The new value for the settingpublic boolean getUseMinifiedResources()
getUseMinifiedResources in interface IResourceSettingspublic Comparator<? super ResourceAggregator.RecordedHeaderItem> getHeaderItemComparator()
getHeaderItemComparator in interface IResourceSettingspublic void setHeaderItemComparator(Comparator<? super ResourceAggregator.RecordedHeaderItem> headerItemComparator)
IResourceSettingsPriorityFirstComparator.
setHeaderItemComparator in interface IResourceSettingsheaderItemComparator - The comparator used to sort header items, when null, header items will not be
sorted.public boolean isEncodeJSessionId()
IResourceSettings
isEncodeJSessionId in interface IResourceSettingstrue if the jsessionid should be encoded in the url for resources
implementing
IStaticCacheableResource when the
cookies are disabled and there is an active http session.public void setEncodeJSessionId(boolean encodeJSessionId)
IResourceSettingsIStaticCacheableResource when
the cookies are disabled and there is an active http session.
setEncodeJSessionId in interface IResourceSettingsencodeJSessionId - true when the jsessionid should be encoded, false - otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||