Example usage for org.apache.wicket.serialize.java DeflatedJavaSerializer DeflatedJavaSerializer

List of usage examples for org.apache.wicket.serialize.java DeflatedJavaSerializer DeflatedJavaSerializer

Introduction

In this page you can find the example usage for org.apache.wicket.serialize.java DeflatedJavaSerializer DeflatedJavaSerializer.

Prototype

public DeflatedJavaSerializer(String applicationKey) 

Source Link

Document

Construct.

Usage

From source file:org.devgateway.toolkit.forms.wicket.FormsWebApplication.java

License:Open Source License

/**
 * optimize wicket for a better web performance This will be invoked if the
 * application is started with -Dwicket.configuration=deployment
 *///w ww  .j  av a  2  s.  c  o  m
private void optimizeForWebPerformance() {
    // add javascript files at the bottom of the page
    setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator("scripts-bucket"));

    // This is only enabled for deployment configuration
    // -Dwicket.configuration=deployment
    // 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);
}