String applicationName = requestHeaders.getHeader(
"Mariner-Application");
// Get the application Registry to enable application specific
// initialisation.
ApplicationRegistry applicationRegistry =
ApplicationRegistry.getSingleton();
// Get the factory method to enable the application context
// to be initialised.
ApplicationRegistryContainer applicationRegistryContainer =
applicationRegistry.getApplicationRegistryContainer(
applicationName);
// We did not match our appication so we are either mariner
// or an unknown application, either way we will use the
// default application behaviour.
if (applicationRegistryContainer == null) {
applicationRegistryContainer =
applicationRegistry.getApplicationRegistryContainer(
ApplicationRegistry.DEFAULT_APPLICATION_NAME);
// Still cannot find anything, give in.
if (applicationRegistryContainer == null) {
throw new IllegalStateException(