public class JSLib extends Object
The reason for this is the common use-case of fetching 'standard'-libs from Google or Yahoo instead of the local app if possible, for caching and parallelization reasons.
Usage:
JSLib.getHeaderContributor(VersionDescriptor.exactVersion(Library.JQUERY, 1,3,1))
will serve the appropriate Script as bundled with this project, in either readable or
minimized (if Wicket is in 'deployment'-configuration-type) form.
JSLib.getHeaderContributor(VersionDescriptor.exactVersion(Library.JQUERY, 1,3,1), CDN.ANY)
will serve it from the any CDN where it is available, falling back to the local version
if necessary.
JSLib.getHeaderContributor(VersionDescriptor.exactVersion(Library.JQUERY, 1,3,1), true, CDN.GOOGLE)
will serve it from Google (or the local Version as fallback) in minimized form, no matter
what Wicket´s configuration is.
Component Developers should not select providers.
Application Developers can set the providers they want to use on a per Application basis by using
JSLib.setOverrideProviders(Application.get(), LocalProvider.DEFAULT);
for Local use only, or
JSLib.setOverrideProviders(Application.get(), CDN.GOOGLE);
or even
JSLib.setOverrideProviders(Application.get(), CDN.ANY);
Modifier and Type | Method and Description |
---|---|
static org.apache.wicket.markup.html.IHeaderContributor |
getHeaderContribution(VersionDescriptor versionDescriptor)
Get a header contributor for the given
VersionDescriptor . |
static org.apache.wicket.markup.html.IHeaderContributor |
getHeaderContribution(VersionDescriptor versionDescriptor,
boolean production,
Provider... providers) |
static org.apache.wicket.markup.html.IHeaderContributor |
getHeaderContribution(VersionDescriptor versionDescriptor,
Provider... providers) |
static void |
setOverrideProviders(org.apache.wicket.Application app,
Provider... providers)
Not to be used by Component authors.
|
public static void setOverrideProviders(org.apache.wicket.Application app, Provider... providers)
app
- providers
- public static org.apache.wicket.markup.html.IHeaderContributor getHeaderContribution(VersionDescriptor versionDescriptor)
VersionDescriptor
. This method should be used
by component authors if they want to offer maximum flexibility in reuse of their components.versionDescriptor
- public static org.apache.wicket.markup.html.IHeaderContributor getHeaderContribution(VersionDescriptor versionDescriptor, Provider... providers)
versionDescriptor
- providers
- list of alternative providers (might be ignored if setOverrideProviders was used)public static org.apache.wicket.markup.html.IHeaderContributor getHeaderContribution(VersionDescriptor versionDescriptor, boolean production, Provider... providers)
versionDescriptor
- production
- if true tried to serve minimized versionsproviders
- list of alternative providers (might be ignored if setOverrideProviders was usedCopyright © 2015. All rights reserved.