org.mule.transport.http
Class HttpConnector

java.lang.Object
  extended by org.mule.transport.AbstractConnector
      extended by org.mule.transport.tcp.TcpConnector
          extended by org.mule.transport.http.HttpConnector
All Implemented Interfaces:
ExceptionListener, EventListener, javax.resource.spi.work.WorkListener, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, NamedObject, Connectable, Connector
Direct Known Subclasses:
HttpPollingConnector, HttpsConnector

public class HttpConnector
extends TcpConnector

HttpConnector provides a way of receiving and sending http requests and responses. The Connector itself handles dispatching http requests. The HttpMessageReceiver handles the receiving requests and processing of headers This endpoint recognises the following properties -


Field Summary
protected  HttpConnectionManager clientConnectionManager
           
static String COOKIE_SPEC_NETSCAPE
           
static String COOKIE_SPEC_RFC2109
           
static String DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY
           
static String HTTP
           
static String HTTP_CONTEXT_PATH_PROPERTY
          The context path of the endpoint being accessed.
static String HTTP_COOKIE_SPEC_PROPERTY
           
static String HTTP_COOKIES_PROPERTY
           
static String HTTP_CUSTOM_HEADERS_MAP_PROPERTY
           
static String HTTP_ENABLE_COOKIES_PROPERTY
           
static String HTTP_GET_BODY_PARAM_PROPERTY
           
static Set<String> HTTP_INBOUND_PROPERTIES
           
static String HTTP_METHOD_PROPERTY
           
static String HTTP_PARAMS_PROPERTY
          Allows the user to set a HttpMethodParams object in the client request to be set on the HttpMethod request object
static String HTTP_POST_BODY_PARAM_PROPERTY
           
static String HTTP_PREFIX
           
static String HTTP_REQUEST_PATH_PROPERTY
          The path portion of the URL being accessed.
static String HTTP_REQUEST_PROPERTY
          The path and query portions of the URL being accessed.
static String HTTP_STATUS_PROPERTY
          MuleEvent property to pass back the status for the response
static String HTTP_VERSION_PROPERTY
           
 
Fields inherited from class org.mule.transport.tcp.TcpConnector
CLIENT, DEFAULT_BACKLOG, DEFAULT_BUFFER_SIZE, DEFAULT_SO_LINGER, DEFAULT_SOCKET_TIMEOUT, KEEP_SEND_SOCKET_OPEN_PROPERTY, SERVER, TCP
 
Fields inherited from class org.mule.transport.AbstractConnector
connected, createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatchers, disposed, exceptionListener, initialised, logger, muleContext, name, numberOfConcurrentTransactedReceivers, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, started, startOnConnect
 
Fields inherited from interface org.mule.api.transport.Connector
INT_VALUE_NOT_SET
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
HttpConnector()
           
 
Method Summary
protected  HttpClient doClientConnect()
           
protected  void doInitialise()
           
 HttpConnectionManager getClientConnectionManager()
           
 String getCookieSpec()
           
 String getProtocol()
           
 String getProxyHostname()
           
 String getProxyPassword()
           
 int getProxyPort()
           
 String getProxyUsername()
           
protected  Object getReceiverKey(Service service, InboundEndpoint endpoint)
          The method determines the key used to store the receiver against.
 Map getReceivers()
          Getter for property 'receivers'.
 boolean isEnableCookies()
           
 boolean isFollowRedirects()
           
static String normalizeUrl(String url)
          Ensures that the supplied URL starts with a '/'.
 MessageReceiver registerListener(Service service, InboundEndpoint endpoint)
          This creates a MessageReceiver associated with this endpoint and registers it with the connector
 void setClientConnectionManager(HttpConnectionManager clientConnectionManager)
           
 void setCookieSpec(String cookieSpec)
           
 void setEnableCookies(boolean enableCookies)
           
 void setFollowRedirects(boolean followRedirects)
           
 void setProxyHostname(String host)
           
 void setProxyPassword(String string)
           
 void setProxyPort(int port)
           
 void setProxyUsername(String string)
           
protected  void setupClientAuthorization(MuleEvent event, HttpMethod httpMethod, HttpClient client, ImmutableEndpoint endpoint)
           
 
Methods inherited from class org.mule.transport.tcp.TcpConnector
configureSocket, doConnect, doDisconnect, doDispose, doStart, doStop, getBacklog, getBufferSize, getClientSoTimeout, getKeepAliveMonitor, getKeepAliveTimeout, getOutputStream, getReceiveBacklog, getReceiveBufferSize, getSendBufferSize, getServerSocket, getServerSocketFactory, getServerSoTimeout, getSocket, getSocketFactory, getSocketSoLinger, getTcpProtocol, isKeepAlive, isKeepSendSocketOpen, isResponseEnabled, isReuseAddress, isSendTcpNoDelay, setBacklog, setBufferSize, setClientSoTimeout, setKeepAlive, setKeepAliveTimeout, setKeepSendSocketOpen, setReceiveBacklog, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSendTcpNoDelay, setServerSocketFactory, setServerSoTimeout, setSocketFactory, setSocketSoLinger, setTcpProtocol, setTimeout
 
Methods inherited from class org.mule.transport.AbstractConnector
checkDisposed, connect, createReceiver, destroyReceiver, disconnect, dispatch, dispose, disposeDispatchers, disposeReceivers, disposeRequesters, disposeWorkManagers, exceptionThrown, fireNotification, getConnectEventId, getConnectionDescription, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getExceptionListener, getMaxDispatchersActive, getMaxRequestersActive, getMessageAdapter, getMuleContext, getName, getNumberOfConcurrentTransactedReceivers, getOutputStream, getReceiver, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getReplyToHandler, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getRetryPolicyTemplate, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, handleException, handleException, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isCreateMultipleTransactedReceivers, isDisposed, isEnableMessageEvents, isStarted, isSyncEnabled, isValidateConnections, lookupReceiver, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, send, setConnected, setCreateMultipleTransactedReceivers, setDispatcherFactory, setDispatcherThreadingProfile, setDynamicNotification, setExceptionListener, setMaxDispatchersActive, setMaxRequestersActive, setMuleContext, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterThreadingProfile, setRetryPolicyTemplate, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, setValidateConnections, start, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, validateConnection, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HTTP

public static final String HTTP
See Also:
Constant Field Values

HTTP_PREFIX

public static final String HTTP_PREFIX
See Also:
Constant Field Values

HTTP_STATUS_PROPERTY

public static final String HTTP_STATUS_PROPERTY
MuleEvent property to pass back the status for the response

See Also:
Constant Field Values

HTTP_VERSION_PROPERTY

public static final String HTTP_VERSION_PROPERTY
See Also:
Constant Field Values

HTTP_CUSTOM_HEADERS_MAP_PROPERTY

public static final String HTTP_CUSTOM_HEADERS_MAP_PROPERTY
See Also:
Constant Field Values

HTTP_METHOD_PROPERTY

public static final String HTTP_METHOD_PROPERTY
See Also:
Constant Field Values

HTTP_REQUEST_PROPERTY

public static final String HTTP_REQUEST_PROPERTY
The path and query portions of the URL being accessed.

See Also:
Constant Field Values

HTTP_REQUEST_PATH_PROPERTY

public static final String HTTP_REQUEST_PATH_PROPERTY
The path portion of the URL being accessed. No query string is included.

See Also:
Constant Field Values

HTTP_CONTEXT_PATH_PROPERTY

public static final String HTTP_CONTEXT_PATH_PROPERTY
The context path of the endpoint being accessed. This is the path that the HTTP endpoint is listening on.

See Also:
Constant Field Values

HTTP_PARAMS_PROPERTY

public static final String HTTP_PARAMS_PROPERTY
Allows the user to set a HttpMethodParams object in the client request to be set on the HttpMethod request object

See Also:
Constant Field Values

HTTP_GET_BODY_PARAM_PROPERTY

public static final String HTTP_GET_BODY_PARAM_PROPERTY
See Also:
Constant Field Values

DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY

public static final String DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY
See Also:
Constant Field Values

HTTP_POST_BODY_PARAM_PROPERTY

public static final String HTTP_POST_BODY_PARAM_PROPERTY
See Also:
Constant Field Values

HTTP_INBOUND_PROPERTIES

public static final Set<String> HTTP_INBOUND_PROPERTIES

HTTP_COOKIE_SPEC_PROPERTY

public static final String HTTP_COOKIE_SPEC_PROPERTY
See Also:
Constant Field Values

HTTP_COOKIES_PROPERTY

public static final String HTTP_COOKIES_PROPERTY
See Also:
Constant Field Values

HTTP_ENABLE_COOKIES_PROPERTY

public static final String HTTP_ENABLE_COOKIES_PROPERTY
See Also:
Constant Field Values

COOKIE_SPEC_NETSCAPE

public static final String COOKIE_SPEC_NETSCAPE
See Also:
Constant Field Values

COOKIE_SPEC_RFC2109

public static final String COOKIE_SPEC_RFC2109
See Also:
Constant Field Values

clientConnectionManager

protected HttpConnectionManager clientConnectionManager
Constructor Detail

HttpConnector

public HttpConnector()
Method Detail

doInitialise

protected void doInitialise()
                     throws InitialisationException
Overrides:
doInitialise in class TcpConnector
Throws:
InitialisationException

registerListener

public MessageReceiver registerListener(Service service,
                                        InboundEndpoint endpoint)
                                 throws Exception
Description copied from interface: Connector
This creates a MessageReceiver associated with this endpoint and registers it with the connector

Specified by:
registerListener in interface Connector
Overrides:
registerListener in class AbstractConnector
Parameters:
service - the listening service
endpoint - the endpoint contains the listener endpointUri on which to listen on.
Throws:
Exception - if the MessageReceiver cannot be created or the Receiver cannot be registered
See Also:
Connector#registerListener(Service, Endpoint)

getReceiverKey

protected Object getReceiverKey(Service service,
                                InboundEndpoint endpoint)
The method determines the key used to store the receiver against.

Overrides:
getReceiverKey in class AbstractConnector
Parameters:
service - the service for which the endpoint is being registered
endpoint - the endpoint being registered for the service
Returns:
the key to store the newly created receiver against

getProtocol

public String getProtocol()
Specified by:
getProtocol in interface Connector
Overrides:
getProtocol in class TcpConnector
Returns:
the primary protocol name for endpoints of this connector
See Also:
Connector.getProtocol()

getProxyHostname

public String getProxyHostname()
Returns:

getProxyPassword

public String getProxyPassword()
Returns:

getProxyPort

public int getProxyPort()
Returns:

getProxyUsername

public String getProxyUsername()
Returns:

setProxyHostname

public void setProxyHostname(String host)
Parameters:
host -

setProxyPassword

public void setProxyPassword(String string)
Parameters:
string -

setProxyPort

public void setProxyPort(int port)
Parameters:
port -

setProxyUsername

public void setProxyUsername(String string)
Parameters:
string -

getReceivers

public Map getReceivers()
Description copied from class: AbstractConnector
Getter for property 'receivers'.

Overrides:
getReceivers in class AbstractConnector
Returns:
Value for property 'receivers'.

getCookieSpec

public String getCookieSpec()

setCookieSpec

public void setCookieSpec(String cookieSpec)

isEnableCookies

public boolean isEnableCookies()

setEnableCookies

public void setEnableCookies(boolean enableCookies)

getClientConnectionManager

public HttpConnectionManager getClientConnectionManager()

setClientConnectionManager

public void setClientConnectionManager(HttpConnectionManager clientConnectionManager)

isFollowRedirects

public boolean isFollowRedirects()

setFollowRedirects

public void setFollowRedirects(boolean followRedirects)

doClientConnect

protected HttpClient doClientConnect()
                              throws Exception
Throws:
Exception

setupClientAuthorization

protected void setupClientAuthorization(MuleEvent event,
                                        HttpMethod httpMethod,
                                        HttpClient client,
                                        ImmutableEndpoint endpoint)
                                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

normalizeUrl

public static String normalizeUrl(String url)
Ensures that the supplied URL starts with a '/'.

Parameters:
url -
Returns:


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.