use of org.apache.wicket.spring.injection.annot.SpringComponentInjector in project ocvn by devgateway.
the class FormsWebApplication method init.
/**
* <ul>
* <li>making the wicket components injectable by activating the
* SpringComponentInjector</li>
* <li>mounting the test page</li>
* <li>logging spring service method output to showcase working integration
* </li>
* </ul>
*/
@Override
protected void init() {
super.init();
// add allowed woff2 extension
IPackageResourceGuard packageResourceGuard = getResourceSettings().getPackageResourceGuard();
if (packageResourceGuard instanceof SecurePackageResourceGuard) {
SecurePackageResourceGuard guard = (SecurePackageResourceGuard) packageResourceGuard;
guard.addPattern("+*.woff2");
guard.addPattern("+*.xlsx");
}
//this ensures that spring DI works for wicket components and pages
//see @SpringBean annotation
getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
//this will scan packages for pages with @MountPath annotations and automatically create URLs for them
new AnnotatedMountScanner().scanPackage(BASE_PACKAGE_FOR_PAGES).mount(this);
getApplicationSettings().setUploadProgressUpdatesEnabled(true);
getApplicationSettings().setAccessDeniedPage(Homepage.class);
// deactivate ajax debug mode
// getDebugSettings().setAjaxDebugModeEnabled(false);
configureBootstrap();
configureSummernote();
optimizeForWebPerformance();
// http://.../wicket/internal/debug/diskDataStore
if (usesDevelopmentConfig()) {
DebugDiskDataStore.register(this);
}
SessionFinderHolder.setSessionFinder(sessionFinderService);
}
use of org.apache.wicket.spring.injection.annot.SpringComponentInjector in project midpoint by Evolveum.
the class MidPointApplication method init.
@Override
public void init() {
super.init();
getJavaScriptLibrarySettings().setJQueryReference(new PackageResourceReference(MidPointApplication.class, "../../../../../webjars/adminlte/2.3.11/plugins/jQuery/jquery-2.2.3.min.js"));
GuiComponents.init();
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
ResourceSettings resourceSettings = getResourceSettings();
resourceSettings.setParentFolderPlaceholder("$-$");
resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));
SecurePackageResourceGuard guard = (SecurePackageResourceGuard) resourceSettings.getPackageResourceGuard();
guard.addPattern("+*.woff2");
List<IStringResourceLoader> resourceLoaders = resourceSettings.getStringResourceLoaders();
resourceLoaders.add(0, new Utf8BundleStringResourceLoader("localization/Midpoint"));
resourceLoaders.add(1, new Utf8BundleStringResourceLoader(SchemaConstants.SCHEMA_LOCALIZATION_PROPERTIES_RESOURCE_BASE_PATH));
resourceSettings.setThrowExceptionOnMissingResource(false);
getMarkupSettings().setStripWicketTags(true);
if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
getDebugSettings().setAjaxDebugModeEnabled(true);
getDebugSettings().setDevelopmentUtilitiesEnabled(true);
}
//pretty url for resources (e.g. images)
mountFiles(ImgResources.BASE_PATH, ImgResources.class);
//exception handling an error pages
ApplicationSettings appSettings = getApplicationSettings();
appSettings.setAccessDeniedPage(PageError401.class);
appSettings.setInternalErrorPage(PageError.class);
appSettings.setPageExpiredErrorPage(PageError.class);
mount(new MountedMapper("/error", PageError.class, new PageParametersEncoder()));
mount(new MountedMapper("/error/401", PageError401.class, new PageParametersEncoder()));
mount(new MountedMapper("/error/403", PageError403.class, new PageParametersEncoder()));
mount(new MountedMapper("/error/404", PageError404.class, new PageParametersEncoder()));
mount(new MountedMapper("/error/410", PageError410.class, new PageParametersEncoder()));
getRequestCycleListeners().add(new LoggingRequestCycleListener(this));
//descriptor loader, used for customization
new DescriptorLoader().loadData(this);
}
Aggregations