Search in sources :

Example 1 with SystemPropertiesSymbolProvider

use of org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider in project tapestry-5 by apache.

the class TapestryIOCModule method setupStandardSymbolProviders.

/**
 * <dl>
 * <dt>SystemProperties</dt>
 * <dd>Exposes JVM System properties as symbols (currently case-sensitive)</dd>
 * <dt>EnvironmentVariables</dt>
 * <dd>Exposes environment variables as symbols (adding a "env." prefix)</dd>
 * <dt>ApplicationDefaults</dt>
 * <dd>Values contributed to @{@link SymbolProvider} @{@link ApplicationDefaults}</dd>
 * <dt>FactoryDefaults</dt>
 * <dd>Values contributed to @{@link SymbolProvider} @{@link FactoryDefaults}</dd>
 * </dl>
 */
@Contribute(SymbolSource.class)
public static void setupStandardSymbolProviders(OrderedConfiguration<SymbolProvider> configuration, @ApplicationDefaults SymbolProvider applicationDefaults, @FactoryDefaults SymbolProvider factoryDefaults) {
    configuration.add("SystemProperties", new SystemPropertiesSymbolProvider(), "before:*");
    configuration.add("EnvironmentVariables", new SystemEnvSymbolProvider());
    configuration.add("ApplicationDefaults", applicationDefaults);
    configuration.add("FactoryDefaults", factoryDefaults);
}
Also used : SystemEnvSymbolProvider(org.apache.tapestry5.ioc.internal.services.SystemEnvSymbolProvider) SystemPropertiesSymbolProvider(org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider)

Example 2 with SystemPropertiesSymbolProvider

use of org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider in project tapestry-5 by apache.

the class TapestryFilter method init.

/**
 * Initializes the filter using the {@link TapestryAppInitializer}. The application name is the
 * capitalization of
 * the filter name (as specified in web.xml).
 */
public final void init(FilterConfig filterConfig) throws ServletException {
    config = filterConfig;
    final ServletContext context = config.getServletContext();
    String filterName = config.getFilterName();
    SymbolProvider combinedProvider = new DelegatingSymbolProvider(new SystemPropertiesSymbolProvider(), new SingleKeySymbolProvider(TapestryHttpSymbolConstants.CONTEXT_PATH, context.getContextPath()), new ServletContextSymbolProvider(context), new SingleKeySymbolProvider(TapestryHttpSymbolConstants.EXECUTION_MODE, "production"));
    String executionMode = combinedProvider.valueForSymbol(TapestryHttpSymbolConstants.EXECUTION_MODE);
    TapestryAppInitializer appInitializer = new TapestryAppInitializer(logger, combinedProvider, filterName, executionMode);
    appInitializer.addModules(provideExtraModuleDefs(context));
    appInitializer.addModules(provideExtraModuleClasses(context));
    registry = appInitializer.createRegistry();
    context.setAttribute(REGISTRY_CONTEXT_NAME, registry);
    ServletApplicationInitializer ai = registry.getService("ServletApplicationInitializer", ServletApplicationInitializer.class);
    ai.initializeApplication(context);
    registry.performRegistryStartup();
    handler = registry.getService("HttpServletRequestHandler", HttpServletRequestHandler.class);
    asyncRequestService = registry.getService("AsyncRequestService", AsyncRequestService.class);
    init(registry);
    appInitializer.announceStartup();
    registry.cleanupThread();
}
Also used : TapestryAppInitializer(org.apache.tapestry5.http.internal.TapestryAppInitializer) ServletApplicationInitializer(org.apache.tapestry5.http.services.ServletApplicationInitializer) ServletContextSymbolProvider(org.apache.tapestry5.http.internal.ServletContextSymbolProvider) SystemPropertiesSymbolProvider(org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider) DelegatingSymbolProvider(org.apache.tapestry5.http.internal.util.DelegatingSymbolProvider) SymbolProvider(org.apache.tapestry5.ioc.services.SymbolProvider) SingleKeySymbolProvider(org.apache.tapestry5.http.internal.SingleKeySymbolProvider) SingleKeySymbolProvider(org.apache.tapestry5.http.internal.SingleKeySymbolProvider) AsyncRequestService(org.apache.tapestry5.http.internal.AsyncRequestService) ServletContext(javax.servlet.ServletContext) DelegatingSymbolProvider(org.apache.tapestry5.http.internal.util.DelegatingSymbolProvider) SystemPropertiesSymbolProvider(org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider) ServletContextSymbolProvider(org.apache.tapestry5.http.internal.ServletContextSymbolProvider) HttpServletRequestHandler(org.apache.tapestry5.http.services.HttpServletRequestHandler)

Aggregations

SystemPropertiesSymbolProvider (org.apache.tapestry5.ioc.internal.services.SystemPropertiesSymbolProvider)2 ServletContext (javax.servlet.ServletContext)1 AsyncRequestService (org.apache.tapestry5.http.internal.AsyncRequestService)1 ServletContextSymbolProvider (org.apache.tapestry5.http.internal.ServletContextSymbolProvider)1 SingleKeySymbolProvider (org.apache.tapestry5.http.internal.SingleKeySymbolProvider)1 TapestryAppInitializer (org.apache.tapestry5.http.internal.TapestryAppInitializer)1 DelegatingSymbolProvider (org.apache.tapestry5.http.internal.util.DelegatingSymbolProvider)1 HttpServletRequestHandler (org.apache.tapestry5.http.services.HttpServletRequestHandler)1 ServletApplicationInitializer (org.apache.tapestry5.http.services.ServletApplicationInitializer)1 SystemEnvSymbolProvider (org.apache.tapestry5.ioc.internal.services.SystemEnvSymbolProvider)1 SymbolProvider (org.apache.tapestry5.ioc.services.SymbolProvider)1