Example usage for org.apache.wicket.request.resource.caching NoOpResourceCachingStrategy INSTANCE

List of usage examples for org.apache.wicket.request.resource.caching NoOpResourceCachingStrategy INSTANCE

Introduction

In this page you can find the example usage for org.apache.wicket.request.resource.caching NoOpResourceCachingStrategy INSTANCE.

Prototype

IResourceCachingStrategy INSTANCE

To view the source code for org.apache.wicket.request.resource.caching NoOpResourceCachingStrategy INSTANCE.

Click Source Link

Document

Global instance of NoOpResourceCachingStrategy strategy

Usage

From source file:com.userweave.application.UserWeaveApplication.java

License:Open Source License

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

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    setupAuthorization();//from   w w  w .  j  a  v  a2s .  co m

    mountPages();
    mountResources();

    getMarkupSettings().setStripWicketTags(true);

    setupErrorHandling();

    setupProductionSettings();

    setDefaultResourceLocale(LocalizationUtils.getDefaultLocale());

    getMarkupSettings().setMarkupFactory(new MarkupFactory() {

        @Override
        public MarkupParser newMarkupParser(MarkupResourceStream resource) {
            MarkupParser markupParser = new MarkupParser(resource);

            markupParser.add(new AbstractMarkupFilter() {
                //               @Override
                //               public MarkupElement nextTag() throws ParseException {
                //                    
                //                  // Get the next tag. If null, no more tags are available
                //                    final ComponentTag tag = (ComponentTag)getParent().nextTag();
                //                    if ( null == tag || null != tag.getId() )
                //                        return tag;
                //
                //                    // Process open <html> tags
                //                    if( null != tag.getName() && tag.getName().equals( "html" ) && tag.isOpen())
                //                    {
                //                       String language = UserWeaveSession.get().getLocale().getLanguage();
                //                        tag.getAttributes().put("lang", language);
                //                        tag.getAttributes().put("xml:lang", language);
                //                        tag.setModified( true );
                //                    }
                //
                //                    return tag;
                //               }

                @Override
                protected MarkupElement onComponentTag(ComponentTag tag) throws ParseException {
                    if (null == tag || null != tag.getId()) {
                        return tag;
                    }

                    // Process open <html> tags
                    if (null != tag.getName() && tag.getName().equals("html") && tag.isOpen()) {
                        String language = UserWeaveSession.get().getLocale().getLanguage();
                        tag.getAttributes().put("lang", language);
                        tag.getAttributes().put("xml:lang", language);
                        tag.setModified(true);
                    }

                    return tag;
                }
            });

            return markupParser;
        }
    });

    /*
     * @see: migration guide to wicket 1.5 Request cycle
     * 
     * Instead of overrride newRequestCycle, we have to create a factory,
     * that builds our custom RequestCycle.
     */
    setRequestCycleProvider(new IRequestCycleProvider() {
        @Override
        public RequestCycle get(RequestCycleContext context) {
            return new UserWeaveWebRequestCycle(context);
        }
    });

    /*
     * @see: https://cwiki.apache.org/WICKET/request-mapping.html
     * 
     * newRequestCycleProcessor is obsolete, so we replace the
     * CryptedUrlWebRequestCodingStrategy with a CryptoMapper,
     */
    //      if(ENCRYPTION)
    //      {
    //         setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
    //      }

    // add custom listener for runtime exceptions.
    getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception ex) {
            if (ex instanceof RuntimeException) {
                ((UserWeaveWebRequestCycle) cycle).handleRuntimeException((RuntimeException) ex);
            }

            return null;
        }
    });

    // disable caching strategy
    getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
}

From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.home.page.ApplicationPageBase.java

License:Apache License

@Override
protected void onConfigure() {
    super.onConfigure();
    logoutPanel.setVisible(AuthenticatedWebSession.get().isSignedIn());

    // Do not cache pages in development mode - allows us to make changes to the HMTL without
    // having to reload the application
    if (RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType())) {
        getApplication().getMarkupSettings().getMarkupFactory().getMarkupCache().clear();
        getApplication().getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
    }//from   w  w w. ja  v a2 s.c  o  m
}

From source file:fiftyfive.wicket.BaseWicketTest.java

License:Apache License

@Before
public void createTester() {
    this.tester = new WicketTester(new FoundationApplication() {
        public Class getHomePage() {
            return DummyHomePage.class;
        }//w  w w  . j av  a2s.com

        @Override
        public RuntimeConfigurationType getConfigurationType() {
            return RuntimeConfigurationType.DEPLOYMENT;
        }

        @Override
        protected void init() {
            super.init();
            getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
        }
    });
}

From source file:fiftyfive.wicket.js.IntegrationTest.java

License:Apache License

@Test
public void testRender() throws Exception {
    WicketTester t = new WicketTester(new WebApplication() {
        @Override/* w  w w . j  a  va 2 s .  c om*/
        public Class<? extends WebPage> getHomePage() {
            return IntegrationTestPage.class;
        }

        @Override
        protected void init() {
            super.init();
            getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
            JavaScriptDependencySettings.get().addLibraryPath(IntegrationTest.class, "customlib");
        }
    });
    t.startPage(IntegrationTestPage.class);
    t.assertRenderedPage(IntegrationTestPage.class);
    t.assertResultPage(IntegrationTestPage.class, "IntegrationTestPage-expected.html");
}

From source file:fiftyfive.wicket.js.v3.IntegrationTest.java

License:Apache License

@Test
public void testRender() throws Exception {
    WicketTester t = new WicketTester(new WebApplication() {
        @Override// w w w  .j a  v  a2 s  .c o m
        public Class<? extends WebPage> getHomePage() {
            return IntegrationTestPage.class;
        }

        @Override
        protected void init() {
            super.init();
            getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
            JavaScriptDependencySettings.get().addLibraryPath(IntegrationTest.class, "customlib")
                    .setSprocketsParser(new SprocketsParserImplV3());
        }
    });
    t.startPage(IntegrationTestPage.class);
    t.assertRenderedPage(IntegrationTestPage.class);
    t.assertResultPage(IntegrationTestPage.class, "IntegrationTestPage-expected.html");
}

From source file:guru.mmp.application.web.template.resources.ErrorImageResourceStreamResource.java

License:Apache License

/**
 * Returns the caching strategy for the resource stream resource.
 *
 * @return the caching strategy for the resource stream resource
 *///from  w  w  w.j a  va2  s  .c  o m
@Override
protected IResourceCachingStrategy getCachingStrategy() {
    return NoOpResourceCachingStrategy.INSTANCE;
}