|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IResourceSettings
Interface for resource related settings
resourcePollFrequency (defaults to no polling frequency) - Frequency at which resources should be polled for changes.
resourceFinder (classpath) - Set this to alter the search path for resources.
useDefaultOnMissingResource (defaults to true) - Set to true to return a default value if available when a required string resource is not found. If set to false then the throwExceptionOnMissingResource flag is used to determine how to behave. If no default is available then this is the same as if this flag were false
A ResourceStreamLocator - An Application's ResourceStreamLocator is used to find resources such as images or markup files. You can supply your own ResourceStreamLocator if your prefer to store your application's resources in a non-standard location (such as a different filesystem location, a particular JAR file or even a database) by overriding the getResourceLocator() method.
Resource Factories - Resource factories can be used to create resources dynamically from
specially formatted HTML tag attribute values. For more details, see IResourceFactory
,
DefaultButtonImageResourceFactory
and
especially LocalizedImageResource
.
A Localizer The getLocalizer() method returns an object encapsulating all of the
functionality required to access localized resources. For many localization problems, even this
will not be required, as there are convenience methods available to all components:
Component.getString(String key)
and
Component.getString(String key, IModel model)
.
stringResourceLoaders - A chain of IStringResourceLoader
instances that are
searched in order to obtain string resources used during localization. By default the chain is
set up to first search for resources against a particular component (e.g. page etc.) and then
against the application.
Method Summary | |
---|---|
void |
addResourceFactory(java.lang.String name,
IResourceFactory resourceFactory)
Adds a resource factory to the list of factories to consult when generating resources automatically |
void |
addResourceFolder(java.lang.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()
|
IJavaScriptCompressor |
getJavaScriptCompressor()
Get the javascript compressor to remove comments and whitespace characters from javascripts |
IPackageResourceGuard |
getPackageResourceGuard()
Gets the package resource guard . |
java.lang.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(java.lang.String name)
|
IResourceFinder |
getResourceFinder()
Gets the resource finder to use when searching for resources. |
Duration |
getResourcePollFrequency()
|
java.util.List<IStringResourceLoader> |
getStringResourceLoaders()
|
boolean |
getThrowExceptionOnMissingResource()
|
boolean |
getUseDefaultOnMissingResource()
|
void |
setCachingStrategy(IResourceCachingStrategy strategy)
sets the resource caching strategy |
ICssCompressor |
setCssCompressor(ICssCompressor compressor)
Set the CSS compressor implemententation use e.g. |
void |
setDefaultCacheDuration(Duration defaultDuration)
Set the the default cache duration for resources. |
void |
setFileCleaner(IFileCleaner fileCleaner)
Sets a cleaner that can be used to remove files asynchronously. |
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(java.lang.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)
|
Methods inherited from interface org.apache.wicket.resource.IPropertiesFactoryContext |
---|
getLocalizer, getResourceStreamLocator, getResourceWatcher |
Method Detail |
---|
void addResourceFactory(java.lang.String name, IResourceFactory resourceFactory)
name
- The name to give to the factoryresourceFactory
- The resource factory to addvoid addResourceFolder(java.lang.String resourceFolder)
resourceFolder
- The resourceFolder to setDuration getDefaultCacheDuration()
Duration.NONE
IPackageResourceGuard getPackageResourceGuard()
package resource guard
.
IPropertiesFactory getPropertiesFactory()
IResourceFactory getResourceFactory(java.lang.String name)
name
- Name of the factory to get
IResourceFinder getResourceFinder()
setResourceFinder(IResourceFinder)
Duration getResourcePollFrequency()
setResourcePollFrequency(Duration)
java.util.List<IStringResourceLoader> getStringResourceLoaders()
boolean getThrowExceptionOnMissingResource()
boolean getUseDefaultOnMissingResource()
void setDefaultCacheDuration(Duration defaultDuration)
defaultDuration
- default cache duration in secondsDuration.NONE
,
WebResponse.MAX_CACHE_DURATION
void setLocalizer(Localizer localizer)
localizer
- void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
package resource guard
.
packageResourceGuard
- The package resource guardvoid setPropertiesFactory(IPropertiesFactory factory)
factory
- void setResourceFinder(IResourceFinder resourceFinder)
resourceFinder
- The resourceFinder to setvoid setResourcePollFrequency(Duration resourcePollFrequency)
resourcePollFrequency
- Frequency at which to poll resources or null
if polling should be
disabledsetResourceFinder(IResourceFinder)
void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator)
resourceStreamLocator
- new resource stream locatorvoid setResourceWatcher(IModificationWatcher watcher)
watcher
- void setFileCleaner(IFileCleaner fileCleaner)
Used internally to delete the temporary files created by FileUpload functionality
fileCleaner
- the actual cleaner implementation. Can be null
IFileCleaner getFileCleaner()
void setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
throwExceptionOnMissingResource
- void setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
useDefaultOnMissingResource
- Whether to use a default value (if available) when a missing resource is requestedIJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor)
JavaScriptPackageResource
. A typical implementation will remove comments and whitespace. But
a no-op implementation is available as well.
compressor
- The implementation to be used
IJavaScriptCompressor getJavaScriptCompressor()
JavaScriptPackageResource
. Null is a valid value.java.lang.String getParentFolderPlaceholder()
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.
void setParentFolderPlaceholder(java.lang.String sequence)
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.
sequence
- character sequence which must not be ambiguous within urlsgetParentFolderPlaceholder()
IResourceCachingStrategy getCachingStrategy()
void setCachingStrategy(IResourceCachingStrategy strategy)
strategy
- instance of resource caching strategyIResourceCachingStrategy
ICssCompressor setCssCompressor(ICssCompressor compressor)
CssPackageResource
. A typical
implementation will remove comments and whitespace. But a no-op implementation is available
as well.
compressor
- The implementation to be used
ICssCompressor getCssCompressor()
CssPackageResource
. Null is a valid value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |