|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
void |
addResourceFolder(String resourceFolder)
Convenience method that sets the resource search path to a single folder. |
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)
|
IResourceFinder |
getResourceFinder()
Gets the resource finder to use when searching for resources. |
Duration |
getResourcePollFrequency()
|
IResourceStreamLocator |
getResourceStreamLocator()
|
IModificationWatcher |
getResourceWatcher(boolean start)
|
List<IStringResourceLoader> |
getStringResourceLoaders()
|
boolean |
getThrowExceptionOnMissingResource()
|
boolean |
getUseDefaultOnMissingResource()
|
boolean |
getUseDefaultResourceAggregator()
|
boolean |
getUseMinifiedResources()
|
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 |
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 |
setResourceFinder(IResourceFinder resourceFinder)
Sets the finder 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 |
setUseDefaultResourceAggregator(boolean useDefaultResourceAggregator)
Allows to disable the default resource aggregation. |
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 IResourceSettings
name
- The name to give to the factoryresourceFactory
- The resource factory to addIResourceSettings.addResourceFactory(java.lang.String,
org.apache.wicket.IResourceFactory)
public void addResourceFolder(String resourceFolder)
IResourceSettings
addResourceFolder
in interface IResourceSettings
resourceFolder
- The resourceFolder to setIResourceSettings.addResourceFolder(java.lang.String)
public Localizer getLocalizer()
IPropertiesFactoryContext
IResourceSettings.getStringResourceLoaders()
.
getLocalizer
in interface IPropertiesFactoryContext
IPropertiesFactoryContext.getLocalizer()
public IPackageResourceGuard getPackageResourceGuard()
IResourceSettings
package resource guard
.
getPackageResourceGuard
in interface IResourceSettings
IResourceSettings.getPackageResourceGuard()
public IPropertiesFactory getPropertiesFactory()
IResourceSettings
getPropertiesFactory
in interface IResourceSettings
IResourceSettings.getPropertiesFactory()
public IResourceFactory getResourceFactory(String name)
getResourceFactory
in interface IResourceSettings
name
- Name of the factory to get
IResourceSettings.getResourceFactory(java.lang.String)
public IResourceFinder getResourceFinder()
IResourceSettings
getResourceFinder
in interface IResourceSettings
IResourceSettings.getResourceFinder()
public Duration getResourcePollFrequency()
getResourcePollFrequency
in interface IResourceSettings
IResourceSettings.getResourcePollFrequency()
public IResourceStreamLocator getResourceStreamLocator()
getResourceStreamLocator
in interface IPropertiesFactoryContext
IPropertiesFactoryContext.getResourceStreamLocator()
public IModificationWatcher getResourceWatcher(boolean start)
getResourceWatcher
in interface IPropertiesFactoryContext
start
- boolean if the resource watcher should be started if not already started.
IPropertiesFactoryContext.getResourceWatcher(boolean)
public void setResourceWatcher(IModificationWatcher watcher)
IResourceSettings
setResourceWatcher
in interface IResourceSettings
IResourceSettings.setResourceWatcher(org.apache.wicket.util.watch.IModificationWatcher)
public IFileCleaner getFileCleaner()
getFileCleaner
in interface IResourceSettings
public void setFileCleaner(IFileCleaner fileUploadCleaner)
IResourceSettings
Used internally to delete the temporary files created by FileUpload functionality
setFileCleaner
in interface IResourceSettings
fileUploadCleaner
- the actual cleaner implementation. Can be null
public List<IStringResourceLoader> getStringResourceLoaders()
getStringResourceLoaders
in interface IResourceSettings
IResourceSettings.getStringResourceLoaders()
public boolean getThrowExceptionOnMissingResource()
getThrowExceptionOnMissingResource
in interface IResourceSettings
IResourceSettings.getThrowExceptionOnMissingResource()
public boolean getUseDefaultOnMissingResource()
getUseDefaultOnMissingResource
in interface IResourceSettings
IResourceSettings.getUseDefaultOnMissingResource()
public void setLocalizer(Localizer localizer)
IResourceSettings
setLocalizer
in interface IResourceSettings
IResourceSettings.setLocalizer(org.apache.wicket.Localizer)
public void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
IResourceSettings
package resource guard
.
setPackageResourceGuard
in interface IResourceSettings
packageResourceGuard
- The package resource guardIResourceSettings.setPackageResourceGuard(org.apache.wicket.markup.html.IPackageResourceGuard)
public void setPropertiesFactory(IPropertiesFactory factory)
IResourceSettings
setPropertiesFactory
in interface IResourceSettings
IResourceSettings.setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory)
public void setResourceFinder(IResourceFinder resourceFinder)
IResourceSettings
setResourceFinder
in interface IResourceSettings
resourceFinder
- The resourceFinder to setIResourceSettings.setResourceFinder(org.apache.wicket.util.file.IResourceFinder)
public void setResourcePollFrequency(Duration resourcePollFrequency)
IResourceSettings
setResourcePollFrequency
in interface IResourceSettings
resourcePollFrequency
- 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 IResourceStream
s which do
not exist.
setResourceStreamLocator
in interface IResourceSettings
resourceStreamLocator
- new resource stream locatorgetResourceStreamLocator()
public void setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
setThrowExceptionOnMissingResource
in interface IResourceSettings
IResourceSettings.setThrowExceptionOnMissingResource(boolean)
public void setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
setUseDefaultOnMissingResource
in interface IResourceSettings
useDefaultOnMissingResource
- Whether to use a default value (if available) when a missing resource is requestedIResourceSettings.setUseDefaultOnMissingResource(boolean)
public final Duration getDefaultCacheDuration()
IResourceSettings
getDefaultCacheDuration
in interface IResourceSettings
IResourceSettings.getDefaultCacheDuration()
public final void setDefaultCacheDuration(Duration duration)
IResourceSettings
setDefaultCacheDuration
in interface IResourceSettings
duration
- default cache duration in secondsIResourceSettings.setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
public IJavaScriptCompressor getJavaScriptCompressor()
IResourceSettings
getJavaScriptCompressor
in interface IResourceSettings
JavaScriptPackageResource
. Null is a valid value.public IJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor)
IResourceSettings
JavaScriptPackageResource
. A typical implementation will remove comments and whitespace. But
a no-op implementation is available as well.
setJavaScriptCompressor
in interface IResourceSettings
compressor
- The implementation to be used
public ICssCompressor getCssCompressor()
IResourceSettings
getCssCompressor
in interface IResourceSettings
CssPackageResource
. Null is a valid value.public ICssCompressor setCssCompressor(ICssCompressor compressor)
IResourceSettings
CssPackageResource
. A typical
implementation will remove comments and whitespace. But a no-op implementation is available
as well.
setCssCompressor
in interface IResourceSettings
compressor
- 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 IResourceSettings
IResourceSettings.getParentFolderPlaceholder()
public void setParentFolderPlaceholder(String sequence)
IResourceSettings
null
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 IResourceSettings
sequence
- character sequence which must not be ambiguous within urlsIResourceSettings.setParentFolderPlaceholder(String)
public IResourceCachingStrategy getCachingStrategy()
IResourceSettings
getCachingStrategy
in interface IResourceSettings
IResourceSettings.getCachingStrategy()
public void setCachingStrategy(IResourceCachingStrategy strategy)
IResourceSettings
setCachingStrategy
in interface IResourceSettings
strategy
- instance of resource caching strategyIResourceSettings.setCachingStrategy(org.apache.wicket.request.resource.caching.IResourceCachingStrategy)
public void setUseDefaultResourceAggregator(boolean useDefaultResourceAggregator)
IResourceSettings
setUseDefaultResourceAggregator
in interface IResourceSettings
useDefaultResourceAggregator
- The new value for the settingpublic boolean getUseDefaultResourceAggregator()
getUseDefaultResourceAggregator
in interface IResourceSettings
public void setUseMinifiedResources(boolean useMinifiedResources)
IResourceSettings
x.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 IResourceSettings
useMinifiedResources
- The new value for the settingpublic boolean getUseMinifiedResources()
getUseMinifiedResources
in interface IResourceSettings
public Comparator<? super ResourceAggregator.RecordedHeaderItem> getHeaderItemComparator()
getHeaderItemComparator
in interface IResourceSettings
public void setHeaderItemComparator(Comparator<? super ResourceAggregator.RecordedHeaderItem> headerItemComparator)
IResourceSettings
PriorityFirstComparator
.
setHeaderItemComparator
in interface IResourceSettings
headerItemComparator
- The comparator used to sort header items, when null, header items will not be
sorted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |