Documentation/Tutorials/Red5DeveloperTips/FiveWaysToApplicationAdapter

Five ways to gain access to your ApplicationAdapter

The ApplicationAdapter is for all intents and purposes your Red5 Application. This is the main entry point of your deployed services.

1. Inject your ApplicationAdapter through Spring  How-to Video

2. Get your ApplicationAdapter from your ApplicationContext

IContext context = scope.getContext();
ApplicationContext appCtx = context.getApplicationContext();
Application app = (Application) appCtx.getBean("web.handler");

3. Inject your service beans into your ApplicaitonAdapter and then have them setup event listeners

// TODO

4. Via the servlet context

ApplicationContext appCtx = (ApplicationContext) getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

5. Via ApplicationContextAware

this.application = (Application) appCtx.getBean("web.handler"); 

6. Via PHP using  Quercus

<?php
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.WebApplicationContext;

$session = $request->getSession(true);
$ctx = $session->getServletContext();
$appCtx = $ctx->getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
?>

More info  PHP support in Red5