Search in sources :

Example 1 with WebContainer

use of com.sun.enterprise.web.WebContainer in project Payara by payara.

the class MapperListener method init.

/**
 * Initialize associated mapper.
 */
public void init() {
    if (webContainer == null) {
        logger.log(Level.SEVERE, LogFacade.CANNOT_FIND_WEB_CONTAINER);
        return;
    }
    try {
        httpService = webContainer.getHttpService();
        engine = webContainer.getEngine();
        if (engine == null) {
            logger.log(Level.SEVERE, LogFacade.CANNOT_FIND_ENGINE);
            return;
        }
        if (defaultHost != null) {
            mapper.setDefaultHostName(defaultHost);
        }
        for (VirtualServer vs : httpService.getVirtualServer()) {
            Container host = engine.findChild(vs.getId());
            if (host instanceof StandardHost) {
                registerHost((StandardHost) host);
                for (Container context : host.findChildren()) {
                    if (context instanceof StandardContext) {
                        registerContext((StandardContext) context);
                        for (Container wrapper : context.findChildren()) {
                            if (wrapper instanceof StandardWrapper) {
                                registerWrapper((StandardWrapper) wrapper);
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        logger.log(Level.WARNING, LogFacade.ERROR_REGISTERING_CONTEXTS, e);
    }
}
Also used : WebContainer(com.sun.enterprise.web.WebContainer) StandardHost(org.apache.catalina.core.StandardHost) StandardContext(org.apache.catalina.core.StandardContext) VirtualServer(com.sun.enterprise.config.serverbeans.VirtualServer) StandardWrapper(org.apache.catalina.core.StandardWrapper)

Aggregations

VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)1 WebContainer (com.sun.enterprise.web.WebContainer)1 StandardContext (org.apache.catalina.core.StandardContext)1 StandardHost (org.apache.catalina.core.StandardHost)1 StandardWrapper (org.apache.catalina.core.StandardWrapper)1