1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
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 | |
|
32 | 0 | } |
33 | |
|
34 | |
public void contextInitialized(ServletContextEvent event) |
35 | |
{ |
36 | 0 | event.getServletContext().setAttribute(MuleProperties.MULE_CONTEXT_PROPERTY, muleContext); |
37 | |
|
38 | 0 | event.getServletContext().setAttribute(AbstractReceiverServlet.SERVLET_CONNECTOR_NAME_PROPERTY, connectorName); |
39 | 0 | event.getServletContext().setAttribute(CONNECTOR_NAME, connectorName); |
40 | 0 | } |
41 | |
} |