Search in sources :

Example 1 with YuiCssCompressor

use of de.agilecoders.wicket.extensions.javascript.YuiCssCompressor 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);
}
Also used : FilenameWithVersionResourceCachingStrategy(org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy) RenderJavaScriptToFooterHeaderResponseDecorator(de.agilecoders.wicket.core.markup.html.RenderJavaScriptToFooterHeaderResponseDecorator) DeflatedJavaSerializer(org.apache.wicket.serialize.java.DeflatedJavaSerializer) NoOpResourceCachingStrategy(org.apache.wicket.request.resource.caching.NoOpResourceCachingStrategy) Adler32ResourceVersion(de.agilecoders.wicket.core.request.resource.caching.version.Adler32ResourceVersion) GoogleClosureJavaScriptCompressor(de.agilecoders.wicket.extensions.javascript.GoogleClosureJavaScriptCompressor) CachingResourceVersion(org.apache.wicket.request.resource.caching.version.CachingResourceVersion) YuiCssCompressor(de.agilecoders.wicket.extensions.javascript.YuiCssCompressor)

Example 2 with YuiCssCompressor

use of de.agilecoders.wicket.extensions.javascript.YuiCssCompressor 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);
}
Also used : FilenameWithVersionResourceCachingStrategy(org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy) RenderJavaScriptToFooterHeaderResponseDecorator(de.agilecoders.wicket.core.markup.html.RenderJavaScriptToFooterHeaderResponseDecorator) DeflatedJavaSerializer(org.apache.wicket.serialize.java.DeflatedJavaSerializer) NoOpResourceCachingStrategy(org.apache.wicket.request.resource.caching.NoOpResourceCachingStrategy) Adler32ResourceVersion(de.agilecoders.wicket.core.request.resource.caching.version.Adler32ResourceVersion) GoogleClosureJavaScriptCompressor(de.agilecoders.wicket.extensions.javascript.GoogleClosureJavaScriptCompressor) CachingResourceVersion(org.apache.wicket.request.resource.caching.version.CachingResourceVersion) YuiCssCompressor(de.agilecoders.wicket.extensions.javascript.YuiCssCompressor)

Aggregations

RenderJavaScriptToFooterHeaderResponseDecorator (de.agilecoders.wicket.core.markup.html.RenderJavaScriptToFooterHeaderResponseDecorator)2 Adler32ResourceVersion (de.agilecoders.wicket.core.request.resource.caching.version.Adler32ResourceVersion)2 GoogleClosureJavaScriptCompressor (de.agilecoders.wicket.extensions.javascript.GoogleClosureJavaScriptCompressor)2 YuiCssCompressor (de.agilecoders.wicket.extensions.javascript.YuiCssCompressor)2 FilenameWithVersionResourceCachingStrategy (org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy)2 NoOpResourceCachingStrategy (org.apache.wicket.request.resource.caching.NoOpResourceCachingStrategy)2 CachingResourceVersion (org.apache.wicket.request.resource.caching.version.CachingResourceVersion)2 DeflatedJavaSerializer (org.apache.wicket.serialize.java.DeflatedJavaSerializer)2