Search in sources :

Example 1 with ServletRegistrationImpl

use of org.apache.catalina.core.ServletRegistrationImpl in project Payara by payara.

the class DynamicWebServletRegistrationImpl method contextListenerStart.

@Override
protected void contextListenerStart() {
    ServletContext servletContext = getServletContext();
    WebBundleDescriptor wbd = getWebBundleDescriptor();
    try {
        // for jsf injection
        servletContext.setAttribute(Constants.DEPLOYMENT_CONTEXT_ATTRIBUTE, getWebModuleConfig().getDeploymentContext());
        // null check for OSGi/HTTP
        if (wbd != null) {
            servletContext.setAttribute(Constants.IS_DISTRIBUTABLE_ATTRIBUTE, wbd.isDistributable());
        }
        servletContext.setAttribute(Constants.ENABLE_HA_ATTRIBUTE, Boolean.valueOf(webContainer.getServerConfigLookup().calculateWebAvailabilityEnabledFromConfig(this)));
        super.contextListenerStart();
    } finally {
        servletContext.removeAttribute(Constants.DEPLOYMENT_CONTEXT_ATTRIBUTE);
        servletContext.removeAttribute(Constants.IS_DISTRIBUTABLE_ATTRIBUTE);
        servletContext.removeAttribute(Constants.ENABLE_HA_ATTRIBUTE);
    }
    for (ServletRegistrationImpl srImpl : servletRegisMap.values()) {
        if (srImpl instanceof DynamicWebServletRegistrationImpl) {
            DynamicWebServletRegistrationImpl dwsrImpl = (DynamicWebServletRegistrationImpl) srImpl;
            dwsrImpl.postProcessAnnotations();
        }
    }
    webContainer.afterServletContextInitializedEvent(wbd);
}
Also used : DynamicServletRegistrationImpl(org.apache.catalina.core.DynamicServletRegistrationImpl) ServletRegistrationImpl(org.apache.catalina.core.ServletRegistrationImpl) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ServletContext(javax.servlet.ServletContext)

Aggregations

WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)1 ServletContext (javax.servlet.ServletContext)1 DynamicServletRegistrationImpl (org.apache.catalina.core.DynamicServletRegistrationImpl)1 ServletRegistrationImpl (org.apache.catalina.core.ServletRegistrationImpl)1