use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class ContextManagerListener method requestInitialized.
/**
* {@inheritDoc}
*/
public void requestInitialized(ServletRequestEvent event) {
final ExoContainer oldContainer = ExoContainerContext.getCurrentContainerIfPresent();
ExoContainer container = null;
boolean hasBeenSet = false;
try {
container = getContainer(event);
if (container == null)
return;
if (!container.equals(oldContainer)) {
if (container instanceof PortalContainer) {
PortalContainer.setInstance((PortalContainer) container);
}
ExoContainerContext.setCurrentContainer(container);
hasBeenSet = true;
}
onRequestInitialized(container, event);
} finally {
if (hasBeenSet) {
if (container instanceof PortalContainer) {
// Remove the current Portal Container and the current ExoContainer
PortalContainer.setInstance(null);
}
// Re-set the old container
ExoContainerContext.setCurrentContainer(oldContainer);
}
}
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class AbstractHttpSessionListener method sessionCreated.
/**
* @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
*/
public final void sessionCreated(HttpSessionEvent event) {
final ExoContainer oldContainer = ExoContainerContext.getCurrentContainerIfPresent();
// Keep the old ClassLoader
final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
ExoContainer container = null;
boolean hasBeenSet = false;
try {
container = getContainer(event);
if (container == null)
return;
if (!container.equals(oldContainer)) {
if (container instanceof PortalContainer) {
PortalContainer.setInstance((PortalContainer) container);
}
ExoContainerContext.setCurrentContainer(container);
hasBeenSet = true;
}
if (requirePortalEnvironment()) {
final String ctxName = ContainerUtil.getServletContextName(event.getSession().getServletContext());
if (!PortalContainer.isPortalContainerNameDisabled(ctxName) && container instanceof PortalContainer) {
if (PortalContainer.getInstanceIfPresent() == null) {
// The portal container has not been set
PortalContainer.setInstance((PortalContainer) container);
hasBeenSet = true;
}
// Set the full classloader of the portal container
Thread.currentThread().setContextClassLoader(((PortalContainer) container).getPortalClassLoader());
} else {
if (PropertyManager.isDevelopping()) {
LOG.info("The portal environment could not be set for the webapp '" + ctxName + "' because this servlet context has not been defined as a " + "dependency of any portal container or it is a disabled portal" + " container, the sessionCreated event will be ignored");
}
return;
}
}
onSessionCreated(container, event);
} finally {
if (hasBeenSet) {
if (container instanceof PortalContainer) {
// Remove the current Portal Container and the current ExoContainer
PortalContainer.setInstance(null);
}
// Re-set the old container
ExoContainerContext.setCurrentContainer(oldContainer);
}
if (requirePortalEnvironment()) {
// Re-set the old classloader
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
}
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestListenerService method setUp.
public void setUp() throws Exception {
PortalContainer manager = PortalContainer.getInstance();
service_ = (ListenerService) manager.getComponentInstanceOfType(ListenerService.class);
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestMailService method setUp.
public void setUp() throws Exception {
PortalContainer pcontainer = PortalContainer.getInstance();
service = (MailService) pcontainer.getComponentInstanceOfType(MailService.class);
// starting dummy SMTP Server
mailServer = new Wiser();
mailServer.setPort(SMTP_PORT);
mailServer.start();
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestNetService method setUp.
public void setUp() throws Exception {
if (service_ == null) {
PortalContainer manager = PortalContainer.getInstance();
service_ = (NetService) manager.getComponentInstanceOfType(NetService.class);
}
}
Aggregations