Example usage for org.apache.wicket.spring.injection.annot SpringComponentInjector SpringComponentInjector

List of usage examples for org.apache.wicket.spring.injection.annot SpringComponentInjector SpringComponentInjector

Introduction

In this page you can find the example usage for org.apache.wicket.spring.injection.annot SpringComponentInjector SpringComponentInjector.

Prototype

public SpringComponentInjector(final WebApplication webapp, final ApplicationContext ctx,
        final boolean wrapInProxies) 

Source Link

Document

Constructor

Usage

From source file:au.org.theark.web.application.ArkWebApplication.java

License:Open Source License

public void init() {
    log.info("In Constructor of ArkApplication");
    super.init();
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, context(), true));
    SecurePackageResourceGuard guard = new SecurePackageResourceGuard();
    guard.addPattern("+*.js");
    guard.addPattern("+*.jar");

    getResourceSettings().setPackageResourceGuard(guard);
}

From source file:com.francetelecom.clara.cloud.presentation.utils.PaasTestApplication.java

License:Apache License

@Override
protected void defineSpringInjector() {
    if (context != null) {
        getComponentInstantiationListeners().add(new SpringComponentInjector(this, context, true));
    }//w ww . j a  v a 2  s .  com
}

From source file:com.tysanclan.site.projectewok.TysanApplication.java

License:Open Source License

/**
 * @see org.apache.wicket.protocol.http.WebApplication#init()
 *//*www  . j av a 2s.c  om*/
@Override
protected void init() {
    super.init();

    ApplicationContext relevantCtx;

    getComponentInstantiationListeners().add(new TysanSecurity());
    if (testMode) {
        relevantCtx = new ClassPathXmlApplicationContext(new String[] { "services-mock.xml" });
        getComponentInstantiationListeners().add(new SpringComponentInjector(this, relevantCtx, true));
        testContext = relevantCtx;
    } else {
        SpringComponentInjector injector = new SpringComponentInjector(this);
        getComponentInstantiationListeners().add(injector);
    }

    mountBookmarkablePages();
    mountResources();

    getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
    getApplicationSettings().setPageExpiredErrorPage(SessionTimeoutPage.class);

    if (!testMode) {
        scheduleDefaultTasks();
    }

    if (IN_MEMORY.getValue().equals(System.getProperty(IN_MEMORY.getKey()))) {
        TysanScheduler.getScheduler().scheduleTask(new DebugSiteCreationTask());
    }

    // if (usesDeploymentConfig())
    // getApplicationSettings().setInternalErrorPage(TysanErrorPage.class);

    getRequestCycleListeners().add(new ErrorReporterListener());

    getResourceSettings().setUseMinifiedResources(false);

    addResourceReplacement(WiQueryCoreThemeResourceReference.get(),
            new CssResourceReference(TysanApplication.class, "themes/ui-darkness/jquery-ui-1.10.2.custom.css"));
}

From source file:fiftyfive.wicket.spring.FoundationSpringApplication.java

License:Apache License

/**
 * Initializes the {@link SpringComponentInjector}. This allows you to use
 * SpringBean annotations in your Wicket pages and components, which is
 * the easiest way to integrate Wicket and Spring.
 *
 * @see <a href="http://cwiki.apache.org/WICKET/spring.html#Spring-AnnotationbasedApproach">http://cwiki.apache.org/WICKET/spring.html#Spring-AnnotationbasedApproach</a>
 *///from  ww w.ja v a2  s . c  o m
protected void initSpring() {
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, getApplicationContext(), true));
}

From source file:hsa.awp.admingui.WicketApplicationTestContext.java

License:Open Source License

/**
 * Creates a new {@link SpringComponentInjector} mapped to the injected {@link ApplicationContext}.
 *///from w  w w. ja  v a 2  s . c o  m
@Override
protected void init() {
    super.initForTest();
    addComponentInstantiationListener(new SpringComponentInjector(this, ctx, true));
}

From source file:hsa.awp.usergui.WicketApplicationTestContext.java

License:Open Source License

/**
 * Creates a new {@link SpringComponentInjector} mapped to the injected {@link ApplicationContext}.
 *///from   w  w w. j  a va 2  s  . co m
@Override
protected void init() {

    addComponentInstantiationListener(new SpringComponentInjector(this, ctx, true));
}

From source file:it.av.youeat.web.YoueatApplication.java

License:Apache License

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

    getMarkupSettings().setCompressWhitespace(true);
    getMarkupSettings().setStripWicketTags(true);
    // TODO following line disabled to prevent strip of the adSense code, add differently the adsense and an restore the line below
    //getMarkupSettings().setStripComments(inDeployment());

    // THIS LINE IS IMPORTANT - IT INSTALLS THE COMPONENT INJECTOR THAT WILL
    // INJECT NEWLY CREATED COMPONENTS WITH THEIR SPRING DEPENDENCIES
    if (getSpringContext() != null) {
        getComponentInstantiationListeners().add(new SpringComponentInjector(this, getSpringContext(), true));
    }/*from  w w  w  .j a  v a 2  s . c o m*/
    mountPage("/info", AboutPage.class);
    mountPage("/InfoForRestaurateur", InfoForRestaurateurPage.class);
    mountPage("/signIn", SignIn.class);
    mountPage("/signOut", SignOut.class);
    mountPage("/userProfile", UserProfilePage.class);
    mountPage("/userPage", UserManagerPage.class);
    mountPage("/newRistorante", RistoranteAddNewPage.class);
    mountPage("/editRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/", RistoranteEditDataPage.class);
    mountPage("/editAddressRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/",
            RistoranteEditAddressPage.class);
    mountPage("/editPicturesRistorante" + "/${" + YoueatHttpParams.RISTORANTE_ID + "}/",
            RistoranteEditPicturePage.class);
    mountPage(YouEatPagePaths.VIEW_RISTORANTE + "/${" + YoueatHttpParams.RISTORANTE_NAME_AND_CITY + "}/",
            RistoranteViewPage.class);
    mountPage("/searchFriends", SearchFriendPage.class);
    mountPage("/friends", FriendsPage.class);
    mountPage("/signUp", SignUpPage.class);
    mountPage("/userHomePage", UserHomePage.class);
    mountPage(YouEatPagePaths.VIEW_EATER + "/${" + YoueatHttpParams.YOUEAT_ID + "}/", EaterViewPage.class);
    mountPage("/account" + "/${" + YoueatHttpParams.YOUEAT_ID + "}/", EaterAccountPage.class);
    mountPage("/passwordRecover", PasswordRecoverPage.class);
    mountPage("/messages", MessageListPage.class);
    mountPage("/message" + "/${" + YoueatHttpParams.DIALOG_ID + "}/", MessagePage.class);
    mountPage("/picture", ImageViewPage.class);
    mountPage("/index", IndexRistoPage.class);
    mountPage("/xd_receiver.htm", XdReceiver.class);
    mountPage("/privacy", PrivacyPage.class);
    mountPage("/sitemap.xml", SitemapPage.class);
    mountPage("/feed", FeedPage.class);
    mountPage("/ristoManager", RistoranteManagerPage.class);
    mountPage("/activitiesManager", ActivitiesManagerPage.class);
    mountPage("/commentsManager", CommentsManagerPage.class);

    //        mount(new IndexedParamUrlCodingStrategy("/info", AboutPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/InfoForRestaurateur", InfoForRestaurateurPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/signIn", SignIn.class));
    //        mount(new IndexedParamUrlCodingStrategy("/signOut", SignOut.class));
    //        mount(new HybridUrlCodingStrategy("/userProfile", UserProfilePage.class));
    //        mount(new HybridUrlCodingStrategy("/userPage", UserManagerPage.class));
    //        mount(new HybridUrlCodingStrategy("/newRistorante", RistoranteAddNewPage.class));
    //        mount(new MixedParamHybridUrlCodingStrategy("/editRistorante", RistoranteEditDataPage.class, new String[]{YoueatHttpParams.RISTORANTE_ID}));
    //        mount(new MixedParamHybridUrlCodingStrategy("/editAddressRistorante", RistoranteEditAddressPage.class, new String[]{YoueatHttpParams.RISTORANTE_ID}));
    //        mount(new MixedParamHybridUrlCodingStrategy("/editPicturesRistorante", RistoranteEditPicturePage.class, new String[]{YoueatHttpParams.RISTORANTE_ID}));
    //        mount(new MixedParamUrlCodingStrategy(YouEatPagePaths.VIEW_RISTORANTE, RistoranteViewPage.class, new String[]{YoueatHttpParams.RISTORANTE_NAME_AND_CITY}));
    //        mount(new HybridUrlCodingStrategy("/searchFriends", SearchFriendPage.class));
    //        mount(new HybridUrlCodingStrategy("/friends", FriendsPage.class)); 
    //        mount(new IndexedParamUrlCodingStrategy("/signUp", SignUpPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/userHomePage", UserHomePage.class));
    //        mount(new MixedParamHybridUrlCodingStrategy(YouEatPagePaths.VIEW_EATER, EaterViewPage.class, new String[]{YoueatHttpParams.YOUEAT_ID}));
    //        mount(new MixedParamHybridUrlCodingStrategy("/account", EaterAccountPage.class, new String[]{YoueatHttpParams.YOUEAT_ID}));
    //        mount(new HybridUrlCodingStrategy("/passwordRecover", PasswordRecoverPage.class));
    //        mount(new HybridUrlCodingStrategy("/messages", MessageListPage.class));
    //        mount(new MixedParamHybridUrlCodingStrategy("/message", MessagePage.class, new String[]{YoueatHttpParams.DIALOG_ID}));
    //        mount(new HybridUrlCodingStrategy("/picture", ImageViewPage.class));
    //        mount(new QueryStringUrlCodingStrategy("/index", IndexRistoPage.class));
    //        mount(new MixedParamUrlCodingStrategy("/xd_receiver.htm", XdReceiver.class, null));
    //        mount(new IndexedParamUrlCodingStrategy("/privacy", PrivacyPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/sitemap.xml", SitemapPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/feed", FeedPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/ristoManager", RistoranteManagerPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/activitiesManager", ActivitiesManagerPage.class));
    //        mount(new IndexedParamUrlCodingStrategy("/commentsManager", CommentsManagerPage.class));

    getApplicationSettings().setInternalErrorPage(ErrorPage.class);

    setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(80, 443)));
    //to remove page version parameter in the URL.
    this.getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}

From source file:net.rrm.ehour.ui.common.BaseSpringWebAppTester.java

License:Open Source License

public final void setUp(Roles roles) throws Exception {
    webApp = new TestEhourWebApplication() {
        @Override// www . ja va2 s .  c  om
        protected void springInjection() {
            getComponentInstantiationListeners()
                    .add((new SpringComponentInjector(this, getMockContext(), true)));
        }
    };

    webApp.setAuthorizedRoles(roles);
    webApp.setEhourSystemConfig(getEhourSystemConfig());

    afterSetup();
}

From source file:nl.mpi.lamus.web.LamusWicketApplication.java

License:Open Source License

/**
 * @see WebApplication#init()//from  w  w  w .ja  v a2  s . c  o m
 */
@Override
protected void init() {
    super.init();
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext, true));
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    getApplicationSettings().setUploadProgressUpdatesEnabled(true);

    mountPage("/IndexPage", IndexPage.class);
    mountPage("/CreateWorkspacePage", CreateWorkspacePage.class);
    mountPage("/SelectWorkspacePage", SelectWorkspacePage.class);
    mountPage("/ManageWorkspacesPage", ManageWorkspacesPage.class);
    mountPage("/WorkspacePage", WorkspacePage.class);

    PackageResourceReference tlaLogoImageReference = new PackageResourceReference(LamusPage.class,
            "tla_logo.png");
    getSharedResources().add("tlaLogoImage", tlaLogoImageReference.getResource());
    PackageResourceReference homeImageReference = new PackageResourceReference(LamusPage.class, "home.png");
    getSharedResources().add("homeImage", homeImageReference.getResource());
    PackageResourceReference clarinInvertedImageReference = new PackageResourceReference(LamusPage.class,
            "CLARIN-inverted.png");
    getSharedResources().add("clarinInvertedImage", clarinInvertedImageReference.getResource());
}

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 .j ava  2 s  . com*/
    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");

}