ContextLoader loader = (ContextLoader) appCtx
.getBean("context.loader");
appCtx = loader.getContext("default.context");
// Create context for the WebScope and initialize
Context scopeContext = new Context();
scopeContext.setContextPath("/");
scopeContext.setClientRegistry((IClientRegistry) appCtx
.getBean("global.clientRegistry"));
scopeContext.setMappingStrategy((IMappingStrategy) appCtx
.getBean("global.mappingStrategy"));
scopeContext.setServiceInvoker((IServiceInvoker) appCtx
.getBean("global.serviceInvoker"));
scopeContext.setScopeResolver((IScopeResolver) appCtx
.getBean("red5.scopeResolver"));
// The context needs an ApplicationContext so resources can be
// resolved
GenericWebApplicationContext webCtx = new GenericWebApplicationContext();
webCtx.setDisplayName("Automatic generated WebAppContext");
webCtx.setParent(appCtx);
webCtx.setServletContext(ContextHandler.getCurrentContext());
scopeContext.setApplicationContext(webCtx);
// Store context in scope
scope.setContext(scopeContext);
// Use default ApplicationAdapter as handler