List of usage examples for org.apache.wicket.protocol.http WebApplication getSecuritySettings
public final SecuritySettings getSecuritySettings()
From source file:fiftyfive.wicket.shiro.ShiroWicketPlugin.java
License:Apache License
/** * Installs this {@code ShiroWicketPlugin} by doing the following: * <ul>//from w ww . j av a 2 s. c om * <li>Sets itself as the {@link IAuthorizationStrategy}</li> * <li>And as the {@link IUnauthorizedComponentInstantiationListener}</li> * <li>And as an {@link IRequestCycleListener}</li> * <li>Mounts the login page</li> * <li>Mounts the logout page</li> * </ul> */ public void install(WebApplication app) { Args.notNull(app, "app"); ISecuritySettings settings = app.getSecuritySettings(); settings.setAuthorizationStrategy(this); settings.setUnauthorizedComponentInstantiationListener(this); app.getRequestCycleListeners().add(this); // Mount bookmarkable URLs if (this.loginPath != null) { app.mount(new MountedMapper(this.loginPath, this.loginPage)); } if (this.logoutPath != null) { app.mount(new MountedMapper(this.logoutPath, this.logoutPage)); } // Install self in app metadata so that static get() can work ShiroWicketPlugin.set(app, this); }
From source file:org.ops4j.pax.wicket.api.PaxWicketApplicationFactory.java
License:Apache License
private WebApplication createWicketApplicationViaCustomFactory() { WebApplication paxWicketApplication; paxWicketApplication = applicationFactory.createWebApplication(new ApplicationLifecycleListener() { private final List<ServiceRegistration> m_serviceRegistrations = new ArrayList<ServiceRegistration>(); private PageMounterTracker mounterTracker; private ComponentInstantiationListenerFacade componentInstanciationListener; public void onInit(WebApplication wicketApplication) { componentInstanciationListener = new ComponentInstantiationListenerFacade( delegatingComponentInstanciationListener); wicketApplication.addComponentInstantiationListener(componentInstanciationListener); IApplicationSettings applicationSettings = wicketApplication.getApplicationSettings(); applicationSettings.setClassResolver(delegatingClassResolver); addWicketService(IApplicationSettings.class, applicationSettings); ISessionSettings sessionSettings = wicketApplication.getSessionSettings(); sessionSettings.setPageFactory(pageFactory); addWicketService(ISessionSettings.class, sessionSettings); addWicketService(IDebugSettings.class, wicketApplication.getDebugSettings()); addWicketService(IExceptionSettings.class, wicketApplication.getExceptionSettings()); addWicketService(IFrameworkSettings.class, wicketApplication.getFrameworkSettings()); addWicketService(IMarkupSettings.class, wicketApplication.getMarkupSettings()); addWicketService(IPageSettings.class, wicketApplication.getPageSettings()); addWicketService(IRequestCycleSettings.class, wicketApplication.getRequestCycleSettings()); addWicketService(IResourceSettings.class, wicketApplication.getResourceSettings()); addWicketService(ISecuritySettings.class, wicketApplication.getSecuritySettings()); if (pageMounter != null) { for (MountPointInfo bookmark : pageMounter.getMountPoints()) { wicketApplication.mount(bookmark.getCodingStrategy()); }/* ww w. j av a2s. c om*/ } // Now add a tracker so we can still mount pages later mounterTracker = new PageMounterTracker(bundleContext, wicketApplication, getApplicationName()); mounterTracker.open(); for (final IInitializer initializer : initializers) { initializer.init(wicketApplication); } } private <T> void addWicketService(Class<T> service, T serviceImplementation) { Properties props = new Properties(); // Note: This is kept for legacy props.setProperty("applicationId", getApplicationName()); props.setProperty(APPLICATION_NAME, getApplicationName()); String serviceName = service.getName(); ServiceRegistration registration = bundleContext.registerService(serviceName, serviceImplementation, props); m_serviceRegistrations.add(registration); } public void onDestroy(WebApplication wicketApplication) { wicketApplication.removeComponentInstantiationListener(componentInstanciationListener); if (mounterTracker != null) { mounterTracker.close(); mounterTracker = null; } for (ServiceRegistration reg : m_serviceRegistrations) { reg.unregister(); } m_serviceRegistrations.clear(); } }); return paxWicketApplication; }