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) 

Source Link

Document

Constructor used when spring application context is declared in the spring standard way and can be located through WebApplicationContextUtils#getRequiredWebApplicationContext(ServletContext) .

Usage

From source file:almira.sample.web.MainApplication.java

License:Apache License

/**
 * [Dashorst09], page 310./* w ww  .  jav a  2s . c  om*/
 * <p/>
 * See also:
 * http://apache-wicket.1842946.n4.nabble.com/SpringBean-and-serialization-td1872399.html
 */
void initSpringInjector() {
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}

From source file:at.ac.tuwien.ifs.tita.ui.TiTAApplication.java

License:Apache License

/** {@inheritDoc} */
@Override/*from w w w . ja  va2  s . com*/
protected void init() {
    // THIS LINE IS IMPORTANT - IT INSTALLS THE COMPONENT INJECTOR THAT WILL
    // INJECT NEWLY CREATED COMPONENTS WITH THEIR SPRING DEPENDENCIES
    super.init();
    addComponentInstantiationListener(new SpringComponentInjector(this));
    InjectorHolder.getInjector().inject(this);

    uploadFolder = new Folder(System.getProperty("java.io.tmpdir"), "wicket-uploads");
    // Ensure folder exists
    uploadFolder.mkdirs();

    try {
        initDatabase();
    } catch (NoSuchAlgorithmException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    mountBookmarkablePage("/single", EffortImportCSVPage.class);
    new Thread(timerCoordinator).start();
}

From source file:at.molindo.esi4j.example.web.WicketApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *///from w ww.j a v a  2 s  .c  o  m
@Override
public void init() {
    super.init();
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}

From source file:com.adamjan.RootApplication.java

License:Open Source License

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

    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
    //automatically mount all found pages
    new AnnotatedMountScanner().scanPackage("com.adamjan").mount(this);

    setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
    getSecuritySettings().setAuthorizationStrategy(new AnnotationsRoleAuthorizationStrategy(this));

    //mount login page at /login
    mountPage("/login", LoginPage.class);
}

From source file:com.blogspot.chicchiricco.c3wicketdemo.DemoWebapp.java

License:Apache License

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

    // setup Spring
    this.addComponentInstantiationListener(new SpringComponentInjector(this));

    // mounts//from  www.  j  a  v a 2 s. co  m
    this.mount(new CocoonSitemap("/sitemap", "/sitemap.xmap"));
    this.mount(new HybridUrlCodingStrategy("/ajax", Index.class));
    this.mount(new HybridUrlCodingStrategy("/404.html", Error404Page.class));

    // settings
    this.getMarkupSettings().setStripWicketTags(true);

    getResourceSettings().setThrowExceptionOnMissingResource(false);
    getRequestCycleSettings().addResponseFilter(new AjaxServerAndClientTimeFilter());
    getDebugSettings().setAjaxDebugModeEnabled(true);
}

From source file:com.cubeia.backoffice.web.BackofficeApplication.java

License:Open Source License

@Override
protected void init() {
    super.init();
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
    getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
    getMarkupSettings().setStripWicketTags(true);
    //        setRequestCycleProvider(new IRequestCycleProvider() {
    //            @Override
    //            public RequestCycle get(RequestCycleContext ctx) {
    //                // TODO Auto-generated method stub
    //                return new BackofficeRequestCycle(BackofficeApplication.this, (WebRequest) request, response);
    //            }
    //        });

    getRequestCycleListeners().add(new BackofficeRequestCycleListener());
}

From source file:com.evolveum.midpoint.web.security.MidPointApplication.java

License:Apache License

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

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

    IResourceSettings resourceSettings = getResourceSettings();
    resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));

    resourceSettings.setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink("");
    getMarkupSettings().setDefaultAfterDisabledLink("");

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
    }//  ww  w.j a  va2  s  .  co  m

    //pretty url for resources (e.g. images)
    mountFiles(ImgResources.BASE_PATH, ImgResources.class);

    //exception handling an error pages
    IApplicationSettings appSettings = getApplicationSettings();
    appSettings.setAccessDeniedPage(PageError401.class);
    appSettings.setInternalErrorPage(PageError.class);
    appSettings.setPageExpiredErrorPage(PageError.class);

    mount(new MountedMapper("/error", PageError.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/401", PageError401.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/403", PageError403.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/404", PageError404.class, MidPointPageParametersEncoder.ENCODER));

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {

        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception ex) {
            return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
        }
    });

    // todo wicket atmosphere was disabled because of form file upload and redirection url problems.
    //        //ajax push (just an experiment)
    //        eventBus = new EventBus(this);
    //        eventBus.getParameters().setLogLevel(AtmosphereLogLevel.DEBUG);
    //
    //        //enable simple task notifications here
    //        taskManager.registerTaskListener(new TaskListener() {
    //
    //            @Override
    //            public void onTaskStart(Task task) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task start", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " started.",
    //                        OperationResultStatus.SUCCESS));
    //            }
    //
    //            @Override
    //            public void onTaskFinish(Task task, TaskRunResult runResult) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task finish", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " finished.",
    //                        OperationResultStatus.parseStatusType(task.getResultStatus())));
    //            }
    //
    //            @Override
    //            public void onTaskThreadStart(Task task, boolean isRecovering) {
    //
    //            }
    //
    //            @Override
    //            public void onTaskThreadFinish(Task task) {
    //
    //            }
    //        });

    //descriptor loader, used for customization
    new DescriptorLoader().loadData(this);
}

From source file:com.francetelecom.clara.cloud.presentation.WicketApplication.java

License:Apache License

protected void defineSpringInjector() {
    // SpringComponentInjector uses Spring's WebApplicationContextUtils
    // class to retrieve
    // Spring context (loaded from web.xml file).
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}

From source file:com.genericconf.bbbgateway.wicket.GatewayApplication.java

License:Apache License

@Override
protected void init() {
    addComponentInstantiationListener(new SpringComponentInjector(this));

    mount(new IndexedHybridUrlCodingStrategy("home", HomePage.class));
    mount(new IndexedHybridUrlCodingStrategy("create", CreateMeeting.class));
    mount(new IndexedParamUrlCodingStrategy("waiting-room", WaitingRoom.class));
    mount(new IndexedParamUrlCodingStrategy("manage", ManageMeeting.class));

    TimerSettings.INSTANCE.setDevelopment(DEVELOPMENT.equals(getConfigurationType()));
}

From source file:com.kenai.wicketgae.web.WicketApplication.java

License:Apache License

@Override
protected void init() {

    // SpringBean injection
    addComponentInstantiationListener(new SpringComponentInjector(this));

    // Custom modification watcher
    getResourceSettings().setResourceWatcher(new GaeModificationWatcher());

}