use of org.apache.tapestry5.http.internal.TapestryAppInitializer in project tapestry-5 by apache.
the class TapestryAppInitializerTest method testLoadAppModule.
@SuppressWarnings("unchecked")
@Test
public void testLoadAppModule() {
Registry registry = new TapestryAppInitializer(logger, "org.apache.tapestry5.integration.app0", "foo").createRegistry();
Transformer<String> s1 = registry.getService("Service1", Transformer.class);
assertEquals(s1.transform("a"), "A");
}
use of org.apache.tapestry5.http.internal.TapestryAppInitializer 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();
}
Aggregations