Example usage for org.apache.wicket Application CONFIGURATION

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

Introduction

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

Prototype

String CONFIGURATION

To view the source code for org.apache.wicket Application CONFIGURATION.

Click Source Link

Document

Configuration constant for the 2 types

Usage

From source file:com.evolveum.midpoint.web.boot.MidPointSpringApplication.java

License:Apache License

@Bean
public FilterRegistrationBean<WicketFilter> wicket() {
    FilterRegistrationBean<WicketFilter> registration = new FilterRegistrationBean<>();
    registration.setFilter(new WicketFilter());
    registration.setDispatcherTypes(DispatcherType.ERROR, DispatcherType.REQUEST, DispatcherType.FORWARD);
    registration.addUrlPatterns("/*");
    registration.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
    registration.addInitParameter(Application.CONFIGURATION, "deployment"); // development
    registration.addInitParameter("applicationBean", "midpointApplication");
    registration.addInitParameter(WicketFilter.APP_FACT_PARAM,
            "org.apache.wicket.spring.SpringWebApplicationFactory");

    return registration;
}

From source file:com.lyndir.lhunath.grantmywishes.webapp.listener.GrantMyWishesGuiceContext.java

License:Apache License

/**
 * {@inheritDoc}//  www  .  j av  a  2 s .  co  m
 */
@Override
protected Injector getInjector() {

    return Guice.createInjector(Stage.DEVELOPMENT, new DAOModule(), new ServiceModule(), new ServletModule() {

        @Override
        protected void configureServlets() {

            Builder<String, String> paramBuilder;

            // Disable jsessionid in URLs.
            filter("/*").through(DisableURLSessionFilter.class);
            bind(DisableURLSessionFilter.class).in(Scopes.SINGLETON);

            // Wicket
            paramBuilder = ImmutableMap.builder();
            paramBuilder.put(WicketFilter.APP_FACT_PARAM,
                    ContextParamWebApplicationFactory.class.getCanonicalName());
            paramBuilder.put(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                    GrantMyWishesWebApplication.class.getCanonicalName());
            paramBuilder.put(WicketFilter.FILTER_MAPPING_PARAM, PATH_WICKET);
            paramBuilder.put(Application.CONFIGURATION, Application.DEVELOPMENT);

            filter(PATH_WICKET).through(wicketFilter, paramBuilder.build());
            bind(WicketFilter.class).in(Scopes.SINGLETON);
        }
    });
}

From source file:com.lyndir.lhunath.portal.webapp.listener.PortalGuiceContext.java

License:Apache License

/**
 * {@inheritDoc}//w ww .  j a  va 2  s.c o  m
 */
@Override
protected Injector getInjector() {

    return Guice.createInjector(Stage.DEVELOPMENT,
            ImmutableList.<Module>builder().addAll(getApplicationModules()).add(new ServletModule() {

                @Override
                protected void configureServlets() {

                    Builder<String, String> paramBuilder;

                    // Wicket
                    paramBuilder = new ImmutableMap.Builder<String, String>();
                    paramBuilder.put(WicketFilter.APP_FACT_PARAM,
                            ContextParamWebApplicationFactory.class.getCanonicalName());
                    paramBuilder.put(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                            getWebApplication().getCanonicalName());
                    paramBuilder.put(WicketFilter.FILTER_MAPPING_PARAM, PATH_WICKET);
                    paramBuilder.put(Application.CONFIGURATION, Application.DEPLOYMENT);

                    filter(PATH_WICKET).through(wicketFilter, paramBuilder.build());
                    bind(WicketFilter.class).in(Scopes.SINGLETON);
                }
            }).build());
}

From source file:com.norconex.jefmon.server.JEFMonServer.java

License:Apache License

/**
 * Set configuration type by looking for dev.properties file.
 * //w  w w . j a va  2s  . c om
 * This method must be called very early.
 * 
 * The default behavior is to set as RuntimeConfigurationType.DEPLOYMENT 
 */
private void initRuntimeConfiguration() {

    URL resource = new DefaultClassResolver().getClassLoader().getResource("dev.properties");
    if (resource == null) {
        app.setConfigurationType(RuntimeConfigurationType.DEPLOYMENT);
        return;
    }

    try {
        PropertiesConfiguration properties = new PropertiesConfiguration(resource);
        String value = properties.getString("wicket." + Application.CONFIGURATION,
                RuntimeConfigurationType.DEPLOYMENT.toString());
        app.setConfigurationType(RuntimeConfigurationType.valueOf(value.toUpperCase()));
    } catch (ConfigurationException e) {
        throw new JEFMonException("Exception while reading dev.propeties.", e);
    }
}

From source file:com.servoy.j2db.server.headlessclient.WebClientsApplication.java

License:Open Source License

public WebClientsApplication fakeInit() {
    setWicketFilter(new WicketFilter() {
        private static final long serialVersionUID = 1L;

        /**// w  w  w .  j av a  2 s . co m
         * @see wicket.protocol.http.WicketFilter#getFilterConfig()
         */
        @Override
        public FilterConfig getFilterConfig() {
            return new FilterConfig() {
                public String getFilterName() {
                    return "fakeservlet"; //$NON-NLS-1$
                }

                public String getInitParameter(String arg0) {
                    return Application.DEPLOYMENT;
                }

                public Enumeration<String> getInitParameterNames() {
                    return new Enumeration<String>() {
                        int i = 0;

                        /**
                         * @see java.util.Enumeration#hasMoreElements()
                         */
                        public boolean hasMoreElements() {
                            return i == 0;
                        }

                        /**
                         * @see java.util.Enumeration#nextElement()
                         */
                        public String nextElement() {
                            i++;
                            return Application.CONFIGURATION;
                        }
                    };
                }

                public ServletContext getServletContext() {
                    return new MockServletContext(WebClientsApplication.this, null);
                }
            };
        }
    });
    internalInit();
    return this;
}

From source file:com.userweave.application.UserWeaveApplication.java

License:Open Source License

private void setupProductionSettings() {
    boolean inDevelopment = Application.CONFIGURATION.equals(getConfigurationType());
    if (inDevelopment) {
        return;/*  w  w w .ja va  2s  . c  o  m*/
    }

    getMarkupSettings().setStripComments(true);
    getResourceSettings().setThrowExceptionOnMissingResource(false);
}

From source file:edu.uci.ics.hyracks.control.cc.web.WebServer.java

License:Apache License

private Handler createAdminConsoleHandler() {
    FilterHolder filter = new FilterHolder(WicketFilter.class);
    filter.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
            HyracksAdminConsoleApplication.class.getName());
    filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
    filter.setInitParameter(Application.CONFIGURATION, RuntimeConfigurationType.DEPLOYMENT.toString());

    ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    handler.setContextPath("/adminconsole");
    handler.setAttribute(ClusterControllerService.class.getName(), ccs);
    handler.addFilter(filter, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
    handler.addServlet(DefaultServlet.class, "/");
    return handler;
}

From source file:org.geoserver.web.GeoServerApplication.java

License:Open Source License

@Override
public String getConfigurationType() {
    String config = GeoServerExtensions.getProperty("wicket." + Application.CONFIGURATION,
            getApplicationContext());/* w w  w  .j  a  va 2s. c  o  m*/
    if (config == null) {
        return DEPLOYMENT;
    } else if (!DEPLOYMENT.equalsIgnoreCase(config) && !DEVELOPMENT.equalsIgnoreCase(config)) {
        LOGGER.warning("Unknown Wicket configuration value '" + config + "', defaulting to DEPLOYMENT");
        return DEPLOYMENT;
    } else {
        return config;
    }
}