public class ResourceMount extends Object implements Cloneable
| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceMount.SuffixMismatchStrategy |
| Modifier and Type | Field and Description |
|---|---|
static org.apache.wicket.MetaDataKey<ICssCompressor> |
CSS_COMPRESSOR_KEY
MetaDataKey used for
CompressedMergedCssResource |
static int |
DEFAULT_AGGRESIVE_CACHE_DURATION
Deprecated.
typo in name, it's aggressive with ss, use
DEFAULT_AGGRESSIVE_CACHE_DURATION instead |
static int |
DEFAULT_AGGRESSIVE_CACHE_DURATION
default aggressive cache duration is 1 year
|
static int |
DEFAULT_CACHE_DURATION
default cache duration is 1 hour
|
static Set<String> |
DEFAULT_COMPRESS_SUFFIXES
file suffixes to be compressed by default ("css", "js", "html", "xml").
|
static Set<String> |
DEFAULT_MERGE_SUFFIXES
file suffixes to be merged by default ("css" and "js").
|
| Constructor and Description |
|---|
ResourceMount()
Create a new ResourceMount with default settings
|
ResourceMount(boolean development)
If dCreate a new ResourceMount with default settings
|
| Modifier and Type | Method and Description |
|---|---|
ResourceMount |
addResourceSpec(Class<?> scope,
String name)
add a new
ResourceSpec with this scope and name |
ResourceMount |
addResourceSpec(Class<?> scope,
String name,
Locale locale,
String style,
Integer cacheDuration)
add a new
ResourceSpec with this scope, name, locale, style and cacheDuration |
ResourceMount |
addResourceSpec(org.apache.wicket.ResourceReference ref)
add a
ResourceSpec using a ResourceReference |
ResourceMount |
addResourceSpec(ResourceSpec resourceSpec) |
ResourceMount |
addResourceSpecMatchingSuffix(Class<?> scope,
String suffix)
Adds a resource spec for a resource with the same name as the scope, adding a suffix.
|
ResourceMount |
addResourceSpecs(Class<?> scope,
String... names)
add a new
ResourceSpec with this scope and each name |
ResourceMount |
addResourceSpecs(Iterable<? extends ResourceSpec> resourceSpecs)
add all resource specs
|
ResourceMount |
addResourceSpecs(org.apache.wicket.ResourceReference... refs)
add a
ResourceSpec for each ResourceReference |
ResourceMount |
addResourceSpecs(ResourceSpec... resourceSpecs)
add all resource specs
|
ResourceMount |
addResourceSpecsMatchingSuffix(Class<?>... scopes)
uses the path (set by
setPath(String)) to obtain a suffix to use with
addResourceSpecMatchingSuffix(Class, String) |
ResourceMount |
addResourceSpecsMatchingSuffix(Class<?> scope,
Iterable<String> suffixes)
same as
addResourceSpecMatchingSuffix(Class, String) but using multiple suffixes |
ResourceMount |
addResourceSpecsMatchingSuffix(String suffix,
Class<?>... scopes) |
ResourceMount |
addResourceSpecsMatchingSuffixes(Class<?> scope,
String... suffixes)
same as
addResourceSpecMatchingSuffix(Class, String) but using multiple suffixes |
ResourceMount |
autodetectCacheDuration()
autodetect cache duration: use minimum of all resource specs or
DEFAULT_CACHE_DURATION if
not available. |
ResourceMount |
autodetectCompression()
autodetect whether this resource should be compressed using suffix of file name (e.g.
|
ResourceMount |
autodetectLocale()
Autodetect the locale.
|
ResourceMount |
autodetectMerging()
autodetect whether this resource should be merged using suffix of file name (e.g.
|
ResourceMount |
autodetectMinifyCss()
Autodetect wheter resource should be minified using a CSS compressor.
|
ResourceMount |
autodetectMinifyJs()
Autodetect wheter resource should be minified using a JS compressor.
|
ResourceMount |
autodetectMountScope()
Same as passing
null to setMountScope(Class). |
ResourceMount |
autodetectStyle()
Autodetect the style.
|
ResourceMount |
autodetectVersion()
same as passing
null to setVersion(AbstractResourceVersion) |
org.apache.wicket.behavior.AbstractHeaderContributor |
build(org.apache.wicket.protocol.http.WebApplication application)
same as
mount(WebApplication), but returns an AbstractHeaderContributor to use in components |
org.apache.wicket.behavior.AbstractHeaderContributor |
build(org.apache.wicket.protocol.http.WebApplication application,
String cssMediaType)
same as
mount(WebApplication), but returns an AbstractHeaderContributor to use in components |
protected String |
buildVersionedPath(String path,
AbstractResourceVersion version)
create a versioned path out of the given path and the version.
|
protected void |
checkSuffixes(String path,
Iterable<ResourceSpec> specs)
check if suffixes of path and each RespurceSpec file match
|
ResourceMount |
clearSpecs()
clear all added
ResourceSpecs |
ResourceMount |
clone()
a copy of the resource mount, with unfolded collections of compressed suffixes, merged suffices and
ResourceSpecs |
protected boolean |
doCompress(String file) |
protected boolean |
doMerge()
should the added
ResourceSpecs be merged to a single resource, or should they be mounted idividually?
default is to merge files ending with DEFAULT_MERGE_SUFFIXES |
protected boolean |
doMinifyCss(String file) |
protected boolean |
doMinifyJs(String file) |
static void |
enableAnnotations(org.apache.wicket.protocol.http.WebApplication application)
enable annotation based adding of resources and make sure that the component instantiation listener is only added
once
|
protected int |
getCacheDuration(ResourceSpec[] specs,
boolean versioned)
detect the cache duration to use.
|
Set<String> |
getCompressedSuffixes() |
static ICssCompressor |
getCssCompressor(org.apache.wicket.Application application)
get
ICssCompressor used by CompressedMergedCssResource |
protected Locale |
getLocale(ResourceSpec[] specs)
detect the locale to use.
|
Set<String> |
getMergedSuffixes() |
String |
getPath() |
String |
getPath(String appendName) |
String |
getPath(String appendName,
ResourceSpec[] specs) |
IResourcePreProcessor |
getPreProcessor() |
protected ResourceSpec[] |
getResourceSpecs() |
protected Class<?> |
getScope(ResourceSpec[] specs)
get the mount scope.
|
protected String |
getStyle(ResourceSpec[] specs)
detect the style to use.
|
static String |
getSuffix(String path) |
ResourceMount.SuffixMismatchStrategy |
getSuffixMismatchStrategy() |
protected AbstractResourceVersion |
getVersion(ResourceSpec[] specs)
detect the version.
|
ResourceMount |
mount(org.apache.wicket.protocol.http.WebApplication application)
mount the
ResourceSpec(s) added either as a single Resource or multiple Resource, depending on
doMerge(). |
static void |
mountAnnotatedPackageResources(String mountPrefix,
Class<?> scope,
org.apache.wicket.protocol.http.WebApplication application,
ResourceMount mount) |
static void |
mountAnnotatedPackageResources(String mountPrefix,
Package pkg,
org.apache.wicket.protocol.http.WebApplication application,
ResourceMount mount) |
static void |
mountAnnotatedPackageResources(String mountPrefix,
String packageName,
org.apache.wicket.protocol.http.WebApplication application,
ResourceMount mount)
mount annotated resources from the given package.
|
static void |
mountWicketResources(String mountPrefix,
org.apache.wicket.protocol.http.WebApplication application)
Mount wicket-event.js and wicket-ajax.js using wicket's version for aggressive caching (e.g.
|
static void |
mountWicketResources(String mountPrefix,
org.apache.wicket.protocol.http.WebApplication application,
ResourceMount mount)
Mount wicket-event.js and wicket-ajax.js using wicket's version (e.g.
|
static void |
mountWicketResourcesMerged(String mountPrefix,
org.apache.wicket.protocol.http.WebApplication application)
Mount wicket-event.js and wicket-ajax.js merged using wicket's version for aggressive caching (e.g.
|
static void |
mountWicketResourcesMerged(String mountPrefix,
org.apache.wicket.protocol.http.WebApplication application,
ResourceMount mount)
Mount wicket-event.js and wicket-ajax.js merged using wicket's version (e.g.
|
protected org.apache.wicket.behavior.AbstractHeaderContributor |
newHeaderContributor(List<org.apache.wicket.ResourceReference> refs,
String cssMediaType) |
protected org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy |
newRedirectStrategy(String mountPath,
String redirectPath)
create a new
IRequestTargetUrlCodingStrategy to redirect from mountPath to redirectPath |
protected org.apache.wicket.ResourceReference |
newResourceReference(Class<?> scope,
String name,
Locale locale,
String style,
int cacheDuration,
ResourceSpec[] resourceSpecs,
IResourcePreProcessor preProcessor)
create a new
ResourceReference |
protected org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy |
newStrategy(String mountPath,
org.apache.wicket.ResourceReference ref,
boolean merge)
create a new
IRequestTargetUrlCodingStrategy |
protected void |
onSuffixMismatch(String resource,
String path)
apply
ResourceMount.SuffixMismatchStrategy without further checking, arguments are for logging only |
ResourceMount |
setCacheDuration(int cacheDuration)
Set cache duration in seconds.
|
ResourceMount |
setCompressed(boolean compressed) |
static void |
setCssCompressor(org.apache.wicket.Application application,
ICssCompressor compressor)
set
ICssCompressor used by CompressedMergedCssResource |
ResourceMount |
setDefaultAggresiveCacheDuration()
Deprecated.
typo in name, it's aggressive with ss
|
ResourceMount |
setDefaultAggressiveCacheDuration()
Same as passing
DEFAULT_AGGRESSIVE_CACHE_DURATION to setCacheDuration(int) |
ResourceMount |
setDefaultCacheDuration()
Same as passing
DEFAULT_CACHE_DURATION to setCacheDuration(int) |
ResourceMount |
setLocale(Locale locale)
Locale might either be detected from added
ResourceSpecs or set manually. |
ResourceMount |
setMerged(boolean merge) |
ResourceMount |
setMinifyCss(Boolean minifyCss) |
ResourceMount |
setMinifyJs(Boolean minifyJs) |
ResourceMount |
setMinVersion(AbstractResourceVersion minVersion)
force a minimal version.
|
ResourceMount |
setMinVersion(int minVersionValue)
Convenience method to use a
SimpleResourceVersion as minVersion (e.g. |
ResourceMount |
setMountRedirect(boolean mountRedirect) |
ResourceMount |
setMountScope(Class<?> mountScope)
The mount scope to use.
|
ResourceMount |
setNoVersion()
same as passing
AbstractResourceVersion.NO_VERSION to setVersion(AbstractResourceVersion) |
ResourceMount |
setPath(String path)
the path to user for mounting.
|
ResourceMount |
setPath(String prefix,
org.apache.wicket.ResourceReference ref)
convenience method to use
setPath(String) use a prefix and ResourceReference.getName(). |
ResourceMount |
setPath(String prefix,
org.apache.wicket.ResourceReference ref,
String suffix)
convenience method to use
setPath(String) use a prefix and ResourceReference.getName(). |
ResourceMount |
setPath(String prefix,
String name,
String suffix)
convenience method to use
setPath(String) use a prefix and a name |
ResourceMount |
setPreProcessor(IResourcePreProcessor preProcessor)
use an
IResourcePreProcessor to modify resources (e.g. |
ResourceMount |
setRequireVersion(boolean requireVersion)
IResourceVersionProvider might not always be able to detect the version of a resource. |
ResourceMount |
setResourceVersionProvider(IResourceVersionProvider resourceVersionProvider)
Set the
IResourceVersionProvider to use for AbstractResourceVersion detection |
ResourceMount |
setStyle(String style)
Style might either be detected from added
ResourceSpecs or set manually. |
ResourceMount |
setSuffixMismatchStrategy(ResourceMount.SuffixMismatchStrategy suffixMismatchStrategy) |
ResourceMount |
setVersion(AbstractResourceVersion version)
force a resource version, any
IResourceVersionProvider (
setResourceVersionProvider(IResourceVersionProvider)) will be ignored. |
ResourceMount |
unsetMinVersion()
unset minimal version, same as passing
null to setMinVersion(AbstractResourceVersion) |
public static final int DEFAULT_CACHE_DURATION
public static final int DEFAULT_AGGRESSIVE_CACHE_DURATION
@Deprecated public static final int DEFAULT_AGGRESIVE_CACHE_DURATION
DEFAULT_AGGRESSIVE_CACHE_DURATION insteadpublic static final Set<String> DEFAULT_COMPRESS_SUFFIXES
public static final Set<String> DEFAULT_MERGE_SUFFIXES
public static final org.apache.wicket.MetaDataKey<ICssCompressor> CSS_COMPRESSOR_KEY
CompressedMergedCssResourcepublic ResourceMount()
public ResourceMount(boolean development)
development - true if ResourceMount should be configured with developer-friendly defaults: no caching,
no merging, no minifypublic static void mountWicketResources(String mountPrefix, org.apache.wicket.protocol.http.WebApplication application)
mountPrefix - e.g. "script" for "/script/wicket-ajax-1.3.6.jsapplication - the applicationpublic static void mountWicketResources(String mountPrefix, org.apache.wicket.protocol.http.WebApplication application, ResourceMount mount)
mountPrefix - e.g. "script" for "/script/wicket-ajax-1.3.6.jsapplication - the applicationmount - pre-configured resource mount to use. ResourceVersionProvider will be overridenpublic static void mountWicketResourcesMerged(String mountPrefix, org.apache.wicket.protocol.http.WebApplication application)
mountPrefix - e.g. "script" for "/script/wicket-1.4.7.jsapplication - the applicationpublic static void mountWicketResourcesMerged(String mountPrefix, org.apache.wicket.protocol.http.WebApplication application, ResourceMount mount)
mountPrefix - e.g. "script" for "/script/wicket-1.4.7.jsapplication - the applicationmount - pre-configured resource mount to use. ResourceVersionProvider and Merged will be overriddenpublic static void enableAnnotations(org.apache.wicket.protocol.http.WebApplication application)
application - JsContribution,
CssContributionpublic static void mountAnnotatedPackageResources(String mountPrefix, Class<?> scope, org.apache.wicket.protocol.http.WebApplication application, ResourceMount mount)
public static void mountAnnotatedPackageResources(String mountPrefix, Package pkg, org.apache.wicket.protocol.http.WebApplication application, ResourceMount mount)
public static void mountAnnotatedPackageResources(String mountPrefix, String packageName, org.apache.wicket.protocol.http.WebApplication application, ResourceMount mount)
mount - a preconfigured ResourceMount, won't be changedpathPrefix - pathPrefix to mount resourcespackageName - the scanned packageapplication - JsContribution,
CssContributionpublic static String getSuffix(String path)
path - null if suffix is emptypublic static void setCssCompressor(org.apache.wicket.Application application,
ICssCompressor compressor)
ICssCompressor used by CompressedMergedCssResourceapplication - compressor - public static ICssCompressor getCssCompressor(org.apache.wicket.Application application)
ICssCompressor used by CompressedMergedCssResourceapplication - public ResourceMount setCompressed(boolean compressed)
compressed - whether this resources should be compressed. default is autodetectautodetectCompression()public ResourceMount autodetectCompression()
doCompress(String)setCompressed(boolean)public ResourceMount setMerged(boolean merge)
merge - whether all ResourceSpecs should be merged to a single resource. default is autodetectautodetectMerging()public ResourceMount autodetectMerging()
setMerged(boolean)public ResourceMount setVersion(AbstractResourceVersion version)
IResourceVersionProvider (
setResourceVersionProvider(IResourceVersionProvider)) will be ignored. default is nullversion - versionpublic ResourceMount setNoVersion()
AbstractResourceVersion.NO_VERSION to setVersion(AbstractResourceVersion)setVersion(AbstractResourceVersion)public ResourceMount autodetectVersion()
null to setVersion(AbstractResourceVersion)setVersion(AbstractResourceVersion)public ResourceMount setMinVersion(AbstractResourceVersion minVersion)
nullminVersion - public ResourceMount setMinVersion(int minVersionValue)
SimpleResourceVersion as minVersion (e.g. suitable for
RevisionVersionProvider)minVersionValue - the minimal versionpublic ResourceMount unsetMinVersion()
null to setMinVersion(AbstractResourceVersion)public ResourceMount setRequireVersion(boolean requireVersion)
IResourceVersionProvider might not always be able to detect the version of a resource. This might be
ignored or cause an error depending. default is to cause an error (true)requireVersion - whether version is required (true) or not (false). default is
truepublic ResourceMount setPath(String path)
ResourceSpec.getFile() is appendedpath - name or prefix for mount, with or without leading or trailing slashespublic ResourceMount setPath(String prefix, org.apache.wicket.ResourceReference ref)
setPath(String) use a prefix and ResourceReference.getName().prefix - path prefix prefix for mount, with or without leading or trailing slashesref - a ResourceReferencepublic ResourceMount setPath(String prefix, org.apache.wicket.ResourceReference ref, String suffix)
setPath(String) use a prefix and ResourceReference.getName().prefix - path prefix prefix for mount, with or without leading or trailing slashesref - a ResourceReferencesuffix - suffix to append after ResourceReference.getName(), might be nullpublic ResourceMount setPath(String prefix, String name, String suffix)
setPath(String) use a prefix and a nameprefix - path prefix prefix for mount, with or without leading or trailing slashesname - a namesuffix - suffix to append after ResourceReference.getName(), might be nullpublic ResourceMount setMountRedirect(boolean mountRedirect)
mountRedirect - whether a redirected should be mounted from the unversioned path to the versioned path (only used if
there is a version). default is truepublic ResourceMount setLocale(Locale locale)
ResourceSpecs or set manually.locale - Locale for mounted resourcesResourceReference#setLocale(Locale)}public ResourceMount autodetectLocale()
null to setLocale(Locale)public ResourceMount setStyle(String style)
ResourceSpecs or set manually.style - Style for mounted resourcesResourceReference#setStyle(String)}public ResourceMount autodetectStyle()
null to setStyle(String)public ResourceMount setCacheDuration(int cacheDuration)
null). Must be >= 0cacheDuration - autodetectCacheDuration()public ResourceMount setDefaultCacheDuration()
DEFAULT_CACHE_DURATION to setCacheDuration(int)public ResourceMount setDefaultAggressiveCacheDuration()
DEFAULT_AGGRESSIVE_CACHE_DURATION to setCacheDuration(int)@Deprecated public ResourceMount setDefaultAggresiveCacheDuration()
setDefaultAggressiveCacheDuration()public ResourceMount autodetectCacheDuration()
DEFAULT_CACHE_DURATION if
not available. Behavior might be overriden using #getCacheDuration()public ResourceMount setResourceVersionProvider(IResourceVersionProvider resourceVersionProvider)
IResourceVersionProvider to use for AbstractResourceVersion detectionresourceVersionProvider - the resource version providerpublic ResourceMount setMinifyJs(Boolean minifyJs)
minifyJs - whether js should be minified (true) or not (false). Default is autodetectautodetectMinifyJs()public ResourceMount autodetectMinifyJs()
doMinifyJs(String)public ResourceMount setMinifyCss(Boolean minifyCss)
minifyCss - whether css should be minified (true) or not (false). Default is autodetectautodetectMinifyCss()public ResourceMount autodetectMinifyCss()
doMinifyCss(String)public ResourceMount setMountScope(Class<?> mountScope)
null)mountScope - mount scopeResourceReference.getScope(),
autodetectMountScope()public ResourceMount autodetectMountScope()
null to setMountScope(Class). Autodetect: either use the scope that all
(merged) resources are using or use ResourceMount as mount scope.public IResourcePreProcessor getPreProcessor()
IResourcePreProcessorpublic ResourceMount setPreProcessor(IResourcePreProcessor preProcessor)
IResourcePreProcessor to modify resources (e.g. replace properties, change relative to absolute
paths, ...)preProcessor - public ResourceMount.SuffixMismatchStrategy getSuffixMismatchStrategy()
public ResourceMount setSuffixMismatchStrategy(ResourceMount.SuffixMismatchStrategy suffixMismatchStrategy)
suffixMismatchStrategy - the new strategypublic ResourceMount addResourceSpec(ResourceSpec resourceSpec)
resourceSpec - add a new ResourceSpecpublic ResourceMount addResourceSpec(Class<?> scope, String name)
ResourceSpec with this scope and namescope - scopename - namepublic ResourceMount addResourceSpecs(Class<?> scope, String... names)
ResourceSpec with this scope and each namescope - scopenames - namespublic ResourceMount addResourceSpec(Class<?> scope, String name, Locale locale, String style, Integer cacheDuration)
ResourceSpec with this scope, name, locale, style and cacheDurationscope - scopename - namelocale - localestyle - stylecacheDuration - cache durationpublic ResourceMount addResourceSpecs(ResourceSpec... resourceSpecs)
resourceSpecs - array of ResourceSpecs to addpublic ResourceMount addResourceSpecs(Iterable<? extends ResourceSpec> resourceSpecs)
resourceSpecs - Iterable of ResourceSpecs to addpublic ResourceMount addResourceSpecMatchingSuffix(Class<?> scope, String suffix)
scope - the scopesuffix - the suffixpublic ResourceMount addResourceSpecsMatchingSuffixes(Class<?> scope, String... suffixes)
addResourceSpecMatchingSuffix(Class, String) but using multiple suffixesscope - the scopesuffixes - the suffixespublic ResourceMount addResourceSpecsMatchingSuffix(Class<?> scope, Iterable<String> suffixes)
addResourceSpecMatchingSuffix(Class, String) but using multiple suffixesscope - the scopesuffixes - the suffixespublic ResourceMount addResourceSpecsMatchingSuffix(Class<?>... scopes)
setPath(String)) to obtain a suffix to use with
addResourceSpecMatchingSuffix(Class, String)scopes - public ResourceMount addResourceSpecsMatchingSuffix(String suffix, Class<?>... scopes)
public ResourceMount addResourceSpec(org.apache.wicket.ResourceReference ref)
ResourceSpec using a ResourceReferenceref - the ResourceReferencepublic ResourceMount addResourceSpecs(org.apache.wicket.ResourceReference... refs)
ResourceSpec for each ResourceReferencerefs - the ResourceReferencespublic ResourceMount mount(org.apache.wicket.protocol.http.WebApplication application)
ResourceSpec(s) added either as a single Resource or multiple Resource, depending on
doMerge(). Might also mount a redirect for versioned path names. (e.g. from "/script/wicket-ajax.js" to
"/script/wicket-ajax-1.3.6.js")application - the applicationpublic org.apache.wicket.behavior.AbstractHeaderContributor build(org.apache.wicket.protocol.http.WebApplication application)
mount(WebApplication), but returns an AbstractHeaderContributor to use in componentsapplication - the applicationAbstractHeaderContributor to be used in componentspublic org.apache.wicket.behavior.AbstractHeaderContributor build(org.apache.wicket.protocol.http.WebApplication application,
String cssMediaType)
mount(WebApplication), but returns an AbstractHeaderContributor to use in componentsapplication - the applicationcssMediaType - CSS media type, e.g. "print" or null for no media typeAbstractHeaderContributor to be used in components, all files ending with '.css' will be rendered
with passed cssMediaTypeprotected org.apache.wicket.behavior.AbstractHeaderContributor newHeaderContributor(List<org.apache.wicket.ResourceReference> refs, String cssMediaType)
refs - a list of ResourceReferencesAbstractHeaderContributor that renders references to all CSS and JS resources contained in
refsprotected org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy newStrategy(String mountPath, org.apache.wicket.ResourceReference ref, boolean merge)
IRequestTargetUrlCodingStrategymountPath - the mount pathref - the ResourceReferencemerge - if true, all resources obtained by getResourceSpecs() should be mergedprotected org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy newRedirectStrategy(String mountPath, String redirectPath)
IRequestTargetUrlCodingStrategy to redirect from mountPath to redirectPathmountPath - the path to redirect fromredirectPath - the path to redirect toIRequestTargetUrlCodingStrategypublic final String getPath() throws IResourceVersionProvider.VersionException, AbstractResourceVersion.IncompatibleVersionsException
null and null to
getPath(String, ResourceSpec[])IResourceVersionProvider.VersionException - if version can't be foundAbstractResourceVersion.IncompatibleVersionsException - if versions can't be compared#getPath(String, boolean)public final String getPath(String appendName) throws IResourceVersionProvider.VersionException, AbstractResourceVersion.IncompatibleVersionsException
appendName - appendName and null to
getPath(String, ResourceSpec[])IResourceVersionProvider.VersionException - if version can't be foundAbstractResourceVersion.IncompatibleVersionsException - if versions can't be compared#getPath(String, boolean)public String getPath(String appendName, ResourceSpec[] specs) throws IResourceVersionProvider.VersionException, AbstractResourceVersion.IncompatibleVersionsException, IllegalStateException
appendName - the name to append after pathspecs - a list of specs to get the version from or nullIResourceVersionProvider.VersionException - if version can't be foundAbstractResourceVersion.IncompatibleVersionsException - if versions can't be comparedIllegalStateException - if path not setprotected String buildVersionedPath(String path, AbstractResourceVersion version)
path - the pathversion - the version. must not be null but may be invalid (check version.isValid()!)protected AbstractResourceVersion getVersion(ResourceSpec[] specs) throws IResourceVersionProvider.VersionException, AbstractResourceVersion.IncompatibleVersionsException
IResourceVersionProvider from all specs.specs - the specs to detect the version fromIResourceVersionProvider.VersionException - If a version can't be determined from any resource and version is required
(setRequireVersion(boolean))AbstractResourceVersion.IncompatibleVersionsException - if versions can't be comparedprotected Class<?> getScope(ResourceSpec[] specs)
setMountScope(Class) or detect it. Default is
to use the scope of all specs if it is common or use ResourceMountspecs - the specs to obtain the scope forprotected org.apache.wicket.ResourceReference newResourceReference(Class<?> scope, String name, Locale locale, String style, int cacheDuration, ResourceSpec[] resourceSpecs, IResourcePreProcessor preProcessor)
ResourceReferencescope - scopename - namelocale - localestyle - stylecacheDuration - cache durationresourceSpecs - resource specsResourceReferenceprotected Locale getLocale(ResourceSpec[] specs)
setLocale(Locale)) or detect it from the
given resource specs. An Exception will be thrown if locales of added resources aren't compatible. (e.g.
'de' and 'en'). The resource will always use the most specific locale. For instance, if 5 resources are 'en' and
one is 'en_US', the locale will be 'en_US'specs - the ResourceSpecs to get the locale forprotected String getStyle(ResourceSpec[] specs)
setStyle(String)) or detect it from the given resource specs. An Exception will be thrown if
styles of added resources aren't compatible. (e.g. 'foo' and 'bar', null and 'foo' are considered compatible).
The resource will always use a style if at least one resource uses one. For instance, if 5 resources are don't
have a style and one has 'foo', the style will be 'foo'specs - the ResourceSpecs to get the style forprotected int getCacheDuration(ResourceSpec[] specs, boolean versioned)
setCacheDuration(int)) or detect it from the given resource specs. The resource will always use the
lowest cache duration or DEFAULT_CACHE_DURATION if it can't be detectedspecs - the ResourceSpecs to get the cache duration forif - the resource is versioned.protected ResourceSpec[] getResourceSpecs()
protected boolean doCompress(String file)
file - a file namesetCompressed(boolean),
getCompressedSuffixes()protected boolean doMinifyJs(String file)
file - a file namesetMinifyJs(Boolean)protected boolean doMinifyCss(String file)
file - a file namesetMinifyJs(Boolean)protected boolean doMerge()
ResourceSpecs be merged to a single resource, or should they be mounted idividually?
default is to merge files ending with DEFAULT_MERGE_SUFFIXESsetMerged(boolean),
autodetectMerging(),
getMergedSuffixes()public ResourceMount clearSpecs()
ResourceSpecspublic Set<String> getCompressedSuffixes()
DEFAULT_COMPRESS_SUFFIXESpublic Set<String> getMergedSuffixes()
DEFAULT_MERGE_SUFFIXESprotected void checkSuffixes(String path, Iterable<ResourceSpec> specs)
org.apache.wicket.WicketRuntimeException - if suffixes don't match and strategy is ResourceMount.SuffixMismatchStrategy.EXCEPTIONprotected void onSuffixMismatch(String resource, String path)
ResourceMount.SuffixMismatchStrategy without further checking, arguments are for logging onlyorg.apache.wicket.WicketRuntimeException - if suffixes don't match and strategy is ResourceMount.SuffixMismatchStrategy.EXCEPTIONpublic ResourceMount clone()
ResourceSpecsCopyright © 2017 Molindo GmbH. All Rights Reserved.