Example usage for org.apache.wicket Application getApplicationKey

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

Introduction

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

Prototype

public abstract String getApplicationKey();

Source Link

Document

Gets the unique key of this application within a given context (like a web application).

Usage

From source file:com.github.javawithmarcus.wicket.cdi.CdiConfiguration.java

License:Apache License

protected ConfigurationParameters getApplicationParameters() {
    ConfigurationParameters params = parameters.get(Application.get().getApplicationKey());
    if (params == null) {
        try {//from w w w  .  j  a v a  2  s.co  m
            Application app = Application.get();
            if (app.getApplicationKey() == null) {
                throw new WicketRuntimeException();
            }
            params = new ConfigurationParameters();
            parameters.put(app.getApplicationKey(), params);
        } catch (WicketRuntimeException wre) {
            throw new IllegalStateException("Application is not ready.");
        }
    }
    return params;
}

From source file:com.github.javawithmarcus.wicket.cdi.CdiConfiguration.java

License:Apache License

/**
 * Configures the specified application. This method allows for CdiConfiguration to be setup at the Application
 * Level. Use the {@link CdiWicketFilter} as the filterClass or add the {@link CdiWebApplicationFactory} to the
 * Standard WicketFilter with init-param applicationFactoryClassName for setup during Application Initialization.
 * This allows for Injected classes in the WebApplication to be ready before init() is called.
 * //from w  w w .ja v  a  2  s  .co m
 * @param application
 * @deprecated Application Level Configuration replaced with {@link CdiWicketFilter}
 */
@Deprecated
public void configure(Application application) {
    ConfigurationParameters params = getApplicationParameters();
    configure(application.getApplicationKey(), application, params);
}

From source file:org.brixcms.Brix.java

License:Apache License

public static Brix get(Application application) {
    if (application == null) {
        throw new IllegalArgumentException("application cannot be null");
    }//  w  ww .ja  va2 s.co  m
    Brix brix = application.getMetaData(APP_KEY);
    if (brix == null) {
        throw new IllegalStateException("Could not find instance of Brix associated with application: "
                + application.getApplicationKey()
                + ". Make sure Brix.attachTo(this) was called in application's init() method");
    }
    return brix;
}