View Javadoc

1   /*
2    * $Id: ServletConnector.java 12238 2008-07-06 22:13:50Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.servlet;
12  
13  import org.mule.api.MuleException;
14  import org.mule.api.lifecycle.InitialisationException;
15  import org.mule.transport.AbstractConnector;
16  import org.mule.transport.http.HttpConnector;
17  import org.mule.transport.http.HttpsConnector;
18  
19  import java.util.Map;
20  
21  /**
22   * <code>ServletConnector</code> is a channel adapter between Mule and a servlet
23   * engine. It allows the MuleReceiverServlet to look up components interested in
24   * requests it receives via the servlet container.
25   * 
26   * @see MuleReceiverServlet
27   */
28  
29  public class ServletConnector extends AbstractConnector
30  {
31  
32      public static final String SERVLET = "servlet";
33  
34      // The real URL that the servlet container is bound on.
35      // If this is not set the wsdl may not be generated correctly
36      protected String servletUrl;
37  
38      public ServletConnector()
39      {
40          super();
41          registerSupportedProtocol(HttpConnector.HTTP);
42          registerSupportedProtocol(HttpsConnector.HTTPS);
43      }
44  
45  
46      protected void doInitialise() throws InitialisationException
47      {
48          // template method, nothing to do
49      }
50  
51      protected void doDispose()
52      {
53          // template method
54      }
55  
56      protected void doConnect() throws Exception
57      {
58          // template method
59      }
60  
61      protected void doDisconnect() throws Exception
62      {
63          // template method
64      }
65  
66      protected void doStart() throws MuleException
67      {
68          // template method
69      }
70  
71      protected void doStop() throws MuleException
72      {
73          // template method
74      }
75  
76      public String getProtocol()
77      {
78          return SERVLET;
79      }
80  
81      public Map getReceivers()
82      {
83          return receivers;
84      }
85  
86      public String getServletUrl()
87      {
88          return servletUrl;
89      }
90  
91      public void setServletUrl(String servletUrl)
92      {
93          this.servletUrl = servletUrl;
94      }
95  
96  //    protected Object getReceiverKey(Service service, InboundEndpoint endpoint)
97  //    {
98  //        return service.getName();
99  //    }
100 }