Example usage for org.apache.wicket Application getConfigurationType

List of usage examples for org.apache.wicket Application getConfigurationType

Introduction

In this page you can find the example usage for org.apache.wicket Application getConfigurationType.

Prototype

public abstract RuntimeConfigurationType getConfigurationType();

Source Link

Document

Gets the configuration mode to use for configuring the app, either RuntimeConfigurationType#DEVELOPMENT or RuntimeConfigurationType#DEPLOYMENT .

Usage

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

License:Apache License

/**
 * Sets the RootRequestMapper for the given application from the given httpPort and httpsPort.
 * Note: if the configuration type is RuntimeConfigurationType.DEVELOPMENT then only HTTP scheme
 * will be returned.//from  ww w.ja v  a  2s  .  c o  m
 *
 * @param application
 *            the application
 * @param httpPort
 *            the http port
 * @param httpsPort
 *            the https port
 */
public static void setRootRequestMapperForDevelopment(final Application application, final int httpPort,
        final int httpsPort) {
    application.setRootRequestMapper(
            new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)) {
                @Override
                protected Scheme getDesiredSchemeFor(final Class<? extends IRequestablePage> pageClass) {
                    if (application.getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) {
                        // is in development mode, returning Scheme.HTTP...
                        return Scheme.HTTP;
                    } else {
                        // not in development mode, letting the mapper decide
                        return super.getDesiredSchemeFor(pageClass);
                    }
                }
            });
}

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

License:Apache License

/**
 * Sets the RootRequestMapper for the given application from the given httpPort and httpsPort.
 * Note: if the configuration type is RuntimeConfigurationType.DEVELOPMENT then only HTTP scheme
 * will be returned./*w w w. java2s .c o  m*/
 *
 * @param application
 *            the application
 * @param httpPort
 *            the http port
 * @param httpsPort
 *            the https port
 */
public static void setRootRequestMapperForDevelopment(final Application application, final int httpPort,
        final int httpsPort) {
    application.setRootRequestMapper(
            new HttpsMapper(application.getRootRequestMapper(), new HttpsConfig(httpPort, httpsPort)) {
                @Override
                protected Scheme getDesiredSchemeFor(Class<? extends IRequestablePage> pageClass) {
                    if (application.getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) {
                        // is in development mode, returning Scheme.HTTP...
                        return Scheme.HTTP;
                    } else {
                        // not in development mode, letting the mapper decide
                        return super.getDesiredSchemeFor(pageClass);
                    }
                }
            });
}

From source file:wicket.contrib.tinymce.TinyMceBehavior.java

License:Open Source License

/**
 * <p>//ww w.j ava 2  s .  c o m
 * TinyMCE javascript resource.
 * </p>
 * <p>
 * <strong>Note</strong>: The TinyMCE source cannot be lazily loaded via ajax. Therefore, adding
 * this in a {@link IHeaderContributor#renderHead(IHeaderResponse)} must be done in a component
 * that is not rendered via Ajax. If you wish to load this via Ajax, you can use the very hacky
 * workaround {@link TinyMceBehavior#lazyLoadTinyMCEResource(IHeaderResponse)}.
 * </p>
 * 
 * @return
 */
protected ResourceReference getTinyMCEReference() {
    Application app = Application.get();
    if (RuntimeConfigurationType.DEVELOPMENT.equals(app.getConfigurationType()))
        return TinyMCESettings.REFERENCE;
    else
        return TinyMCESettings.REFERENCE_MIN;
}

From source file:wicket.contrib.tinymce4.TinyMceBehavior.java

License:Open Source License

/**
 * <p>/*w  ww . jav  a 2 s .c  o  m*/
 * TinyMCE javascript resource.
 * </p>
 * <p>
 * <strong>Note</strong>: The TinyMCE source cannot be lazily loaded via ajax. Therefore, adding
 * this in a {@link IHeaderContributor#renderHead(IHeaderResponse)} must be done in a component
 * that is not rendered via Ajax. If you wish to load this via Ajax, you can use the very hacky
 * workaround {@link #lazyLoadTinyMCEResource(IHeaderResponse)}.
 * </p>
 * 
 * @return
 */
protected ResourceReference getTinyMCEReference() {
    Application app = Application.get();
    if (RuntimeConfigurationType.DEVELOPMENT.equals(app.getConfigurationType()))
        return TinyMCESettings.TINYMCE_JS_REF;
    else
        return TinyMCESettings.TINYMCE_JS_REF_MIN;
}