1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport.servlet; |
12 | |
|
13 | |
import org.mule.api.MuleContext; |
14 | |
import org.mule.api.config.MuleProperties; |
15 | |
|
16 | |
import javax.servlet.ServletContextEvent; |
17 | |
import javax.servlet.ServletContextListener; |
18 | |
|
19 | |
public class MuleServletContextListener implements ServletContextListener |
20 | |
{ |
21 | |
public static final String CONNECTOR_NAME = "mule.connector.name"; |
22 | |
|
23 | |
private MuleContext muleContext; |
24 | |
private String connectorName; |
25 | |
|
26 | |
public MuleServletContextListener(MuleContext context, String name) |
27 | |
{ |
28 | 0 | super(); |
29 | 0 | muleContext = context; |
30 | 0 | connectorName = name; |
31 | 0 | } |
32 | |
|
33 | |
public void contextDestroyed(ServletContextEvent sce) |
34 | |
{ |
35 | |
|
36 | 0 | } |
37 | |
|
38 | |
public void contextInitialized(ServletContextEvent event) |
39 | |
{ |
40 | 0 | event.getServletContext().setAttribute(MuleProperties.MULE_CONTEXT_PROPERTY, muleContext); |
41 | |
|
42 | 0 | event.getServletContext().setAttribute(AbstractReceiverServlet.SERVLET_CONNECTOR_NAME_PROPERTY, connectorName); |
43 | 0 | event.getServletContext().setAttribute(CONNECTOR_NAME, connectorName); |
44 | 0 | } |
45 | |
} |