Coverage Report - org.mule.transport.servlet.MuleServletContextListener
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleServletContextListener
0%
0/9
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.servlet;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.config.MuleProperties;
 11  
 
 12  
 import javax.servlet.ServletContextEvent;
 13  
 import javax.servlet.ServletContextListener;
 14  
 
 15  
 public class MuleServletContextListener implements ServletContextListener
 16  
 {
 17  
     public static final String CONNECTOR_NAME = "mule.connector.name";
 18  
 
 19  
     private MuleContext muleContext;
 20  
     private String connectorName;
 21  
 
 22  
     public MuleServletContextListener(MuleContext context, String name)
 23  
     {
 24  0
         super();
 25  0
         muleContext = context;
 26  0
         connectorName = name;
 27  0
     }
 28  
     
 29  
     public void contextDestroyed(ServletContextEvent sce)
 30  
     {
 31  
         // nothing to do
 32  0
     }
 33  
 
 34  
     public void contextInitialized(ServletContextEvent event)
 35  
     {
 36  0
         event.getServletContext().setAttribute(MuleProperties.MULE_CONTEXT_PROPERTY, muleContext);
 37  
         //We keep this for backward compatability
 38  0
         event.getServletContext().setAttribute(AbstractReceiverServlet.SERVLET_CONNECTOR_NAME_PROPERTY, connectorName);
 39  0
         event.getServletContext().setAttribute(CONNECTOR_NAME, connectorName);
 40  0
     }
 41  
 }