use of org.apache.wicket.request.resource.caching.version.CachingResourceVersion in project oc-explorer by devgateway.
the class FormsWebApplication method optimizeForWebPerformance.
/**
* optimize wicket for a better web performance This will be invoked if the
* application is started with -Dwicket.configuration=deployment
*/
private void optimizeForWebPerformance() {
// add javascript files at the bottom of the page
setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator("scripts-bucket"));
// The default is Development, so this code is not used
if (usesDeploymentConfig()) {
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy("-v-", new CachingResourceVersion(new Adler32ResourceVersion())));
getResourceSettings().setJavaScriptCompressor(new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
getResourceSettings().setCssCompressor(new YuiCssCompressor());
getFrameworkSettings().setSerializer(new DeflatedJavaSerializer(getApplicationKey()));
getMarkupSettings().setStripComments(true);
} else {
getResourceSettings().setCachingStrategy(new NoOpResourceCachingStrategy());
}
getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);
}
use of org.apache.wicket.request.resource.caching.version.CachingResourceVersion in project ocvn by devgateway.
the class FormsWebApplication method optimizeForWebPerformance.
/**
* optimize wicket for a better web performance This will be invoked if the
* application is started with -Dwicket.configuration=deployment
*/
private void optimizeForWebPerformance() {
// add javascript files at the bottom of the page
setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator("scripts-bucket"));
// The default is Development, so this code is not used
if (usesDeploymentConfig()) {
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy("-v-", new CachingResourceVersion(new Adler32ResourceVersion())));
getResourceSettings().setJavaScriptCompressor(new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
getResourceSettings().setCssCompressor(new YuiCssCompressor());
getFrameworkSettings().setSerializer(new DeflatedJavaSerializer(getApplicationKey()));
getMarkupSettings().setStripComments(true);
} else {
getResourceSettings().setCachingStrategy(new NoOpResourceCachingStrategy());
}
getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);
}
use of org.apache.wicket.request.resource.caching.version.CachingResourceVersion in project wicket by apache.
the class ResourceSettings method getCachingStrategy.
/**
* gets the resource caching strategy
*
* @return strategy
*/
public IResourceCachingStrategy getCachingStrategy() {
if (resourceCachingStrategy == null) {
final IResourceVersion resourceVersion;
if (application.usesDevelopmentConfig()) {
// development mode:
// use last-modified timestamp of packaged resource for resource caching
// cache the version information for the lifetime of the current http request
resourceVersion = new RequestCycleCachedResourceVersion(new LastModifiedResourceVersion());
} else {
// deployment mode:
// use message digest over resource content for resource caching
// cache the version information for the lifetime of the application
resourceVersion = new CachingResourceVersion(new MessageDigestResourceVersion());
}
// cache resource with a version string in the filename
resourceCachingStrategy = new FilenameWithVersionResourceCachingStrategy(resourceVersion);
}
return resourceCachingStrategy;
}
use of org.apache.wicket.request.resource.caching.version.CachingResourceVersion in project wicket by apache.
the class ResourceMapperWithDecoratedResourcesTest method newApplication.
@Override
protected WebApplication newApplication() {
return new MockApplication() {
@Override
public void init() {
super.init();
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(new CachingResourceVersion(new MessageDigestResourceVersion())));
mountResource("stylesheet.css", new CssResourceReference(ResourceMapperWithDecoratedResourcesTest.class, "decorated-resource.css"));
mountPage("/", HomePage.class);
}
};
}
Aggregations