Example usage for org.apache.wicket.devutils.debugbar DebugBar setContributors

List of usage examples for org.apache.wicket.devutils.debugbar DebugBar setContributors

Introduction

In this page you can find the example usage for org.apache.wicket.devutils.debugbar DebugBar setContributors.

Prototype

public static void setContributors(List<IDebugBarContributor> contributors, Application application) 

Source Link

Usage

From source file:org.devgateway.eudevfin.ui.common.spring.WicketSpringApplication.java

License:Open Source License

@Override
protected void init() {
    super.init();

    configureBootstrap();/*from   w w  w . ja va  2  s.  c  om*/
    configureResourceBundles();

    //http://stackoverflow.com/questions/15996913/wicket-avoid-302-redirect-to-homepage
    //getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

    setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator());

    //mount annotated pages
    new AnnotatedMountScanner().scanPackage("org.devgateway.eudevfin").mount(this);

    //implemented ApplicationContextAware and added context as a parameter to help JUnit tests work
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, springContext, true));

    if (getSecuritySettings().getAuthorizationStrategy() instanceof CompoundAuthorizationStrategy) {
        CompoundAuthorizationStrategy cas = (CompoundAuthorizationStrategy) getSecuritySettings()
                .getAuthorizationStrategy();
        cas.add(new PermissionAuthorizationStrategy());
    }

    getResourceSettings().setUseMinifiedResources(false); //prevents bug in wicket-bootstrap that's trying to minify a png       

    getApplicationSettings().setDefaultMaximumUploadSize(Bytes.megabytes(5));//set maximum file size for upload form

    //DEPLOYMENT MODE?
    if (RuntimeConfigurationType.DEPLOYMENT.equals(this.getConfigurationType())) {
        //compress resources
        getResourceSettings().setJavaScriptCompressor(
                new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
        getResourceSettings().setCssCompressor(new YuiCssCompressor());
    } else {
        //see https://issues.apache.org/jira/browse/WICKET-5388
        //we do not use SessionSizeDebugPanel
        List<IDebugBarContributor> debugContributors = new ArrayList<>();
        debugContributors.add(VersionDebugContributor.DEBUG_BAR_CONTRIB);
        debugContributors.add(InspectorDebugPanel.DEBUG_BAR_CONTRIB);
        debugContributors.add(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB);
        DebugBar.setContributors(debugContributors, this);
    }

    //set response for session timeout:
    getApplicationSettings().setPageExpiredErrorPage(LoginPage.class);

    //add the navbar 
    //        Navbar navbar = new Navbar("navbar");
    //        navbar.setPosition(Navbar.Position.TOP);
    //        // show brand name
    //        navbar.brandName(Model.of("EU-DEVFIN"));
    //        //register the navbar as a spring bean
    //        springContext.getAutowireCapableBeanFactory().initializeBean(navbar, "wicketNavbar");

}