Example usage for org.apache.wicket.core.util.file WebApplicationPath WebApplicationPath

List of usage examples for org.apache.wicket.core.util.file WebApplicationPath WebApplicationPath

Introduction

In this page you can find the example usage for org.apache.wicket.core.util.file WebApplicationPath WebApplicationPath.

Prototype

public WebApplicationPath(final ServletContext servletContext, String path) 

Source Link

Document

Constructor

Usage

From source file:de.alpharogroup.wicket.base.util.application.ApplicationExtensions.java

License:Apache License

/**
 * Adds the given resourcePath to the resource finder from the given application.
 *
 * @param application/*w  w w  . j  a v a  2  s .c  o m*/
 *            the application
 * @param resourcePath
 *            the resource path
 * @see org.apache.wicket.settings.ResourceSettings#getResourceFinders()
 */
public static void addResourceFinder(final WebApplication application, final String resourcePath) {
    application.getResourceSettings().getResourceFinders()
            .add(new WebApplicationPath(application.getServletContext(), resourcePath));
}

From source file:org.jaulp.wicket.base.util.application.ApplicationUtils.java

License:Apache License

/**
 * Adds the given resourcePath to the resource finder from the given application.
 *
 * @see IResourceSettings#getResourceFinders()
 *
 * @param application//from w w w .j ava  2s  .c  o  m
 *            the application
 * @param resourcePath
 *            the resource path
 */
public static void addResourceFinder(final WebApplication application, String resourcePath) {
    application.getResourceSettings().getResourceFinders()
            .add(new WebApplicationPath(application.getServletContext(), resourcePath));
}

From source file:org.sakaiproject.sitestats.tool.wicket.SiteStatsApplication.java

License:Educational Community License

@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);

    // Home page/*from  w w w .ja  v a2 s .c  o  m*/
    mountPage("/home", OverviewPage.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;
            }
        });
    }
}

From source file:org.wicketTutorial.markupfolder.WicketApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *//*from   www.  ja va2 s  .c  o  m*/
@Override
public void init() {
    getResourceSettings().getResourceFinders().add(new WebApplicationPath(getServletContext(), "markupFolder"));
}