org.apache.wicket.spring.injection.annot.SpringComponentInjector Java Examples

The following examples show how to use org.apache.wicket.spring.injection.annot.SpringComponentInjector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShopApplication.java    From the-app with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
    super.init();
    new AnnotatedMountScanner().scanPackage("io.github.zutherb.appstash.shop.ui.page").mount(this);
    getMarkupSettings().setStripWicketTags(true);
    getRequestCycleSettings().setRenderStrategy(
            RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
    getSecuritySettings().setAuthorizationStrategy(new SpringSecurityAuthorizationStrategy());
    getDebugSettings().setAjaxDebugModeEnabled(false);

    setJavaScriptLibrarySettings(new JavaScriptLibrarySettings());

    getRequestCycleListeners().add(new MicroserviceRequestCycleListener());
    getRequestCycleListeners().add(new DockerRequestCycleListener());
    getRequestCycleListeners().add(new BootstrapDesignRequestCycleListener());
    getRequestCycleListeners().add(new DirectBuyRequestCycleListener());
    getRequestCycleListeners().add(new CartRequestCycleListener());
}
 
Example #2
Source File: WicketBootStandardWebApplication.java    From wicket-spring-boot with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
	super.init();
    
	getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
	
	WicketAutoConfig.Builder builder = new WicketAutoConfig.Builder(this.getClass());
	wicketEndpointRepository.add(builder
			.withDetail("signInPages", classCandidates.getSignInPageCandidates())
			.withDetail("homePages", classCandidates.getHomePageCandidates())
			.build());
	
	for (WicketApplicationInitConfiguration configuration : configurations) {
		logger.info("init-config: " + configuration.getClass().getName());
		configuration.init(this);
	}
	
}
 
Example #3
Source File: WicketBootSecuredWebApplication.java    From wicket-spring-boot with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
	super.init();
    
	getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
	
	WicketAutoConfig.Builder builder = new WicketAutoConfig.Builder(this.getClass());
	wicketEndpointRepository.add(builder
			.withDetail("signInPages", classCandidates.getSignInPageCandidates())
			.withDetail("homePages", classCandidates.getHomePageCandidates())
			.build());
	
	for (WicketApplicationInitConfiguration configuration : configurations) {
		logger.info("init-config: " + configuration.getClass().getName());
		configuration.init(this);
	}
	
}
 
Example #4
Source File: ShopApplication.java    From AppStash with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
    super.init();
    new AnnotatedMountScanner().scanPackage("io.github.zutherb.appstash.shop.ui.page").mount(this);
    getMarkupSettings().setStripWicketTags(true);
    getRequestCycleSettings().setRenderStrategy(
            RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
    getSecuritySettings().setAuthorizationStrategy(new SpringSecurityAuthorizationStrategy());
    getDebugSettings().setAjaxDebugModeEnabled(false);

    setJavaScriptLibrarySettings(new JavaScriptLibrarySettings());

    getRequestCycleListeners().add(new MicroserviceRequestCycleListener());
    getRequestCycleListeners().add(new DockerRequestCycleListener());
    getRequestCycleListeners().add(new BootstrapDesignRequestCycleListener());
    getRequestCycleListeners().add(new DirectBuyRequestCycleListener());
    getRequestCycleListeners().add(new CartRequestCycleListener());
}
 
Example #5
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {

    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);
        
    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #6
Source File: ProfileApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void init() {
	super.init();

	// Configure for Spring injection
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	getResourceSettings().setThrowExceptionOnMissingResource(false);
	getMarkupSettings().setStripWicketTags(true);
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);

	// On Wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(MyProfile.class);
	getApplicationSettings().setAccessDeniedPage(MyProfile.class);

	// Custom resource loader since our properties are not in the default location
	getResourceSettings().getStringResourceLoaders().add(new ProfileStringResourceLoader());

	// Throw RuntimeExceptions so they are caught by the Sakai ErrorReportHandler
	getRequestCycleListeners().add(new SakaiRequestCycleListener());

	// page mounting so async calls work correctly with the cryptomapper
	// mountPage("/messages", MyMessages.class);

	// encrypt URLs
	// this immediately sets up a session (note that things like css now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // diff key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
	setRootRequestMapper(cryptoMapper);

	// page mounting
	mountPage("/connections", MyFriends.class);
	mountPage("/messages", MyMessages.class);
	mountPage("/profile", MyProfile.class);
	mountPage("/viewprofile/${id}", ViewProfile.class);

}
 
Example #7
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {

    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #8
Source File: AcademicSessionAdminApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void init() {
	
	//Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	
	
	//Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	
	//Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);
			
	// On Wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(getHomePage());
	getApplicationSettings().setAccessDeniedPage(getHomePage());
	

	
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
		@Override
		 public IRequestHandler onException(RequestCycle cycle, Exception ex) {
			 if (ex instanceof RuntimeException) {
				 RuntimeException re = (RuntimeException)ex;
				 throw re;
			 }
			 return super.onException(cycle, ex);
		}
	});
	
}
 
Example #9
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);
    
    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #10
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #11
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #12
Source File: WicketPageTestBase.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void init()
{
  super.init();
  final ClassPathXmlApplicationContext context = getTestConfiguration().getApplicationContext();
  getComponentInstantiationListeners().add(new SpringComponentInjector(this, context, true));
  getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader(WicketApplication.RESOURCE_BUNDLE_NAME));
  final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
  beanFactory.autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
  UserXmlPreferencesCache.setInternalInstance(userXmlPreferencesCache);
}
 
Example #13
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {

    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);
        
    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #14
Source File: ProfileApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void init() {
	super.init();

	// Configure for Spring injection
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	getResourceSettings().setThrowExceptionOnMissingResource(false);
	getMarkupSettings().setStripWicketTags(true);
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);

	// On Wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(MyProfile.class);
	getApplicationSettings().setAccessDeniedPage(MyProfile.class);

	// Custom resource loader since our properties are not in the default location
	getResourceSettings().getStringResourceLoaders().add(new ProfileStringResourceLoader());

	// Throw RuntimeExceptions so they are caught by the Sakai ErrorReportHandler
	getRequestCycleListeners().add(new SakaiRequestCycleListener());

	// page mounting so async calls work correctly with the cryptomapper
	// mountPage("/messages", MyMessages.class);

	// encrypt URLs
	// this immediately sets up a session (note that things like css now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // diff key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
	setRootRequestMapper(cryptoMapper);

	// page mounting
	mountPage("/connections", MyFriends.class);
	mountPage("/messages", MyMessages.class);
	mountPage("/profile", MyProfile.class);
	mountPage("/viewprofile/${id}", ViewProfile.class);

}
 
Example #15
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {

    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);

    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #16
Source File: AcademicSessionAdminApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void init() {
	
	//Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	
	
	//Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	
	//Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);
			
	// On Wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(getHomePage());
	getApplicationSettings().setAccessDeniedPage(getHomePage());
	

	
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
		@Override
		 public IRequestHandler onException(RequestCycle cycle, Exception ex) {
			 if (ex instanceof RuntimeException) {
				 RuntimeException re = (RuntimeException)ex;
				 throw re;
			 }
			 return super.onException(cycle, ex);
		}
	});
	
}
 
Example #17
Source File: WidgetApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void init() {
    super.init();

    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    // Don't throw an exception if we are missing a property, just fallback
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // Remove the wicket specific tags from the generated markup
    getMarkupSettings().setStripWicketTags(true);

    // Don't add any extra tags around a disabled link (default is <em></em>)
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(getHomePage());

    // cleanup the HTML
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);
    
    // Suppress internal javascript references
    // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name.
    // However it is cleaner if we just handle this manually in the page
    getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));
    getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js")));

    // to put this app into deployment mode, see web.xml
}
 
Example #18
Source File: StorefrontApplication.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Lazy getter of spring injector.
 *
 * @return spring inject support
 */
public SpringComponentInjector getSpringComponentInjector() {
    if (springComponentInjector == null) {
        this.springComponentInjector = new SpringComponentInjector(this);
    }
    return springComponentInjector;
}
 
Example #19
Source File: GradebookNgApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
public void init() {
	super.init();

	// page mounting for bookmarkable URLs
	mountPage("/grades", GradebookPage.class);
	mountPage("/settings", SettingsPage.class);
	mountPage("/importexport", ImportExportPage.class);
	mountPage("/permissions", PermissionsPage.class);
	mountPage("/gradebook", StudentPage.class);
	mountPage("/accessdenied", AccessDeniedPage.class);
	mountPage("/error", ErrorPage.class);

	// remove the version number from the URL so that browser refreshes re-render the page
	getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

	// Configure for Spring injection
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	// Add ResourceLoader that integrates with Sakai's Resource Loader
	getResourceSettings().getStringResourceLoaders().add(0, new GradebookNgStringResourceLoader());

	// Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);

	// Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);

	// Don't add any extra tags around a disabled link (default is <em></em>)
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);

	// On Wicket session timeout, redirect to main page
	// getApplicationSettings().setPageExpiredErrorPage(getHomePage());

	// Intercept any unexpected error stacktrace and take to our page
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
		@Override
		public IRequestHandler onException(final RequestCycle cycle, final Exception e) {
			return new RenderPageRequestHandler(new PageProvider(new ErrorPage(e)));
		}
	});

	// Disable Wicket's loading of jQuery - we load Sakai's preferred version in BasePage.java
	getJavaScriptLibrarySettings().setJQueryReference(new PackageResourceReference(GradebookNgApplication.class, "empty.js"));

	// cleanup the HTML
	getMarkupSettings().setStripWicketTags(true);
	getMarkupSettings().setStripComments(true);
	getMarkupSettings().setCompressWhitespace(true);
}
 
Example #20
Source File: SiteStatsApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
	super.init();

	// Configure general wicket application settings
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	getMarkupSettings().setStripWicketTags(true);
	getResourceSettings().getStringResourceLoaders().add(new SiteStatsStringResourceLoader());
	getResourceSettings().getResourceFinders().add(new WebApplicationPath(getServletContext(), "html"));
	getResourceSettings().setResourceStreamLocator(new SiteStatsResourceStreamLocator());
	getDebugSettings().setAjaxDebugModeEnabled(debug);

	// configure bottom page script loading
	setHeaderResponseDecorator(new JavaScriptToBucketResponseDecorator("bottom-script-container"));

	// Mount pages
	mountPage("/home", OverviewPage.class);
	mountPage("/reports", ReportsPage.class);
	mountPage("/useractivity", UserActivityPage.class);
	mountPage("/preferences", PreferencesPage.class);
	
	// On wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(OverviewPage.class);
	getApplicationSettings().setAccessDeniedPage(OverviewPage.class);

	// Debugging
	debug = ServerConfigurationService.getBoolean("sitestats.debug", false);
	if(debug) {
		getDebugSettings().setComponentUseCheck(true);
		getDebugSettings().setAjaxDebugModeEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
	    getDebugSettings().setOutputComponentPath(true);
	    getDebugSettings().setOutputMarkupContainerClassName(true);
		getDebugSettings().setDevelopmentUtilitiesEnabled(true);
	    getMarkupSettings().setStripWicketTags(false);
		getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
		// register standard debug contributors so that just setting the sitestats.debug property is enough to turn these on
		// otherwise, you have to turn wicket development mode on to get this populated due to the order methods are called
		DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
	}
	else
	{
		// Throw RuntimeDeceptions so they are caught by the Sakai ErrorReportHandler
		getRequestCycleListeners().add(new AbstractRequestCycleListener()
		{
			@Override
			public IRequestHandler onException(RequestCycle cycle, Exception ex)
			{
				if (ex instanceof RuntimeException)
				{
					throw (RuntimeException) ex;
				}
				return null;
			}
		});
	}

	// Encrypt URLs. This immediately sets up a session (note that things like CSS now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // Different key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this); 
	setRootRequestMapper(cryptoMapper);
}
 
Example #21
Source File: OAuthApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
 
Example #22
Source File: OauthAdminApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
 
Example #23
Source File: NextServerApplication.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
protected void addSpringInjection() {
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
 
Example #24
Source File: TestShopApplication.java    From AppStash with Apache License 2.0 4 votes vote down vote up
@Override
protected void init() {
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext, true));
}
 
Example #25
Source File: GradebookNgApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
public void init() {
	super.init();

	// page mounting for bookmarkable URLs
	mountPage("/grades", GradebookPage.class);
	mountPage("/settings", SettingsPage.class);
	mountPage("/importexport", ImportExportPage.class);
	mountPage("/permissions", PermissionsPage.class);
	mountPage("/gradebook", StudentPage.class);
	mountPage("/accessdenied", AccessDeniedPage.class);
	mountPage("/error", ErrorPage.class);

	// remove the version number from the URL so that browser refreshes re-render the page
	getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

	// Configure for Spring injection
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	// Add ResourceLoader that integrates with Sakai's Resource Loader
	getResourceSettings().getStringResourceLoaders().add(0, new GradebookNgStringResourceLoader());

	// Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);

	// Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);

	// Don't add any extra tags around a disabled link (default is <em></em>)
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);

	// On Wicket session timeout, redirect to main page
	// getApplicationSettings().setPageExpiredErrorPage(getHomePage());

	// Intercept any unexpected error stacktrace and take to our page
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
		@Override
		public IRequestHandler onException(final RequestCycle cycle, final Exception e) {
			return new RenderPageRequestHandler(new PageProvider(new ErrorPage(e)));
		}
	});

	// Disable Wicket's loading of jQuery - we load Sakai's preferred version in BasePage.java
	getJavaScriptLibrarySettings().setJQueryReference(new PackageResourceReference(GradebookNgApplication.class, "empty.js"));

	// cleanup the HTML
	getMarkupSettings().setStripWicketTags(true);
	getMarkupSettings().setStripComments(true);
	getMarkupSettings().setCompressWhitespace(true);
}
 
Example #26
Source File: SiteStatsApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
	super.init();

	// Configure general wicket application settings
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	getMarkupSettings().setStripWicketTags(true);
	getResourceSettings().getStringResourceLoaders().add(new SiteStatsStringResourceLoader());
	getResourceSettings().getResourceFinders().add(new WebApplicationPath(getServletContext(), "html"));
	getResourceSettings().setResourceStreamLocator(new SiteStatsResourceStreamLocator());
	getDebugSettings().setAjaxDebugModeEnabled(debug);

	// configure bottom page script loading
	setHeaderResponseDecorator(new JavaScriptToBucketResponseDecorator("bottom-script-container"));

	// Mount pages
	mountPage("/home", OverviewPage.class);
	mountPage("/reports", ReportsPage.class);
	mountPage("/useractivity", UserActivityPage.class);
	mountPage("/preferences", PreferencesPage.class);
	
	// On wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(OverviewPage.class);
	getApplicationSettings().setAccessDeniedPage(OverviewPage.class);

	// Debugging
	debug = ServerConfigurationService.getBoolean("sitestats.debug", false);
	if(debug) {
		getDebugSettings().setComponentUseCheck(true);
		getDebugSettings().setAjaxDebugModeEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
	    getDebugSettings().setOutputComponentPath(true);
	    getDebugSettings().setOutputMarkupContainerClassName(true);
		getDebugSettings().setDevelopmentUtilitiesEnabled(true);
	    getMarkupSettings().setStripWicketTags(false);
		getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
		// register standard debug contributors so that just setting the sitestats.debug property is enough to turn these on
		// otherwise, you have to turn wicket development mode on to get this populated due to the order methods are called
		DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
	}
	else
	{
		// Throw RuntimeDeceptions so they are caught by the Sakai ErrorReportHandler
		getRequestCycleListeners().add(new AbstractRequestCycleListener()
		{
			@Override
			public IRequestHandler onException(RequestCycle cycle, Exception ex)
			{
				if (ex instanceof RuntimeException)
				{
					throw (RuntimeException) ex;
				}
				return null;
			}
		});
	}

	// Encrypt URLs. This immediately sets up a session (note that things like CSS now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // Different key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this); 
	setRootRequestMapper(cryptoMapper);
}
 
Example #27
Source File: OAuthApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
 
Example #28
Source File: OauthAdminApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void init() {
    // Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
 
Example #29
Source File: TestShopApplication.java    From the-app with Apache License 2.0 4 votes vote down vote up
@Override
protected void init() {
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext, true));
}
 
Example #30
Source File: WicketWebApplication.java    From spring-boot-example-wicket with Apache License 2.0 3 votes vote down vote up
/**
 * <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();
    getComponentInstantiationListeners().add(
            new SpringComponentInjector(this, applicationContext));
    mountPage("/mounted.html", MountedPage.class);
    logger.info(exampleService.getText());
}