Advertisement
smallufo

working

Jul 5th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.20 KB | None | 0 0
  1. App :
  2. public class MyApplication extends WebApplication {
  3. @Override
  4.   protected void init()
  5.   {
  6.     super.init();
  7.     getApplicationSettings().setUploadProgressUpdatesEnabled(true);
  8.    
  9.     getComponentInstantiationListeners().add(new SpringComponentInjector(this));
  10.     Injector.get().inject(this);
  11.  
  12.     configureBootstrap();
  13.     optimizeForWebPerformance();
  14.   }
  15.  
  16.   private void configureBootstrap() {
  17.     final IBootstrapSettings settings = new BootstrapSettings();
  18.     //final ThemeProvider themeProvider = new BootswatchThemeProvider(BootswatchTheme.Flatly);
  19.     //settings.setJsResourceFilterName("footer-container").setThemeProvider(themeProvider);
  20.     settings.setJsResourceFilterName("footer-container");
  21.  
  22.     Bootstrap.install(this, settings);
  23.   }
  24.  
  25.  
  26.   /**
  27.    * optimize wicket for a better web performance
  28.    */
  29.   private void optimizeForWebPerformance() {
  30.     if (usesDeploymentConfig()) {
  31.       getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy("-v-", new CachingResourceVersion(new Adler32ResourceVersion())));
  32.  
  33.       getResourceSettings().setJavaScriptCompressor(new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
  34.       getResourceSettings().setCssCompressor(new YuiCssCompressor());
  35.  
  36.       getFrameworkSettings().setSerializer(new DeflatedJavaSerializer(getApplicationKey()));
  37.     }
  38.     else {
  39.       getResourceSettings().setCachingStrategy(new NoOpResourceCachingStrategy());
  40.     }
  41.  
  42.     // setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator());
  43.     getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
  44.   }
  45. }
  46.  
  47. BasePage.java :
  48.   public BasePage(final PageParameters pps) {
  49.     super(pps);
  50.  
  51.     add(new HtmlTag("html"));
  52.  
  53.     add(new OptimizedMobileViewportMetaTag("viewport"));
  54.     add(new ChromeFrameMetaTag("chrome-frame"));
  55.  
  56.     add(newNavbar("navbar" , pps));
  57.     navigation = newNavigation("navigation");
  58.     add(navigation);
  59.  
  60.     add(new Code("code-internal"));
  61.     // add(new HeaderResponseContainer("footer-container", "footer-container"));
  62.   }
  63.  
  64. and remove
  65. <wicket:container wicket:id="footer-container"/>
  66. in BasePage.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement