Class HttpClientTransport
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- org.apache.activemq.transport.TransportSupport
-
- org.apache.activemq.transport.TransportThreadSupport
-
- org.apache.activemq.transport.http.HttpTransportSupport
-
- org.apache.activemq.transport.http.HttpClientTransport
-
- Direct Known Subclasses:
HttpsClientTransport
public class HttpClientTransport extends HttpTransportSupport
A HTTPTransport
which uses the Apache HTTP Client library
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
canSendCompressed
static int
MAX_CLIENT_TIMEOUT
-
Constructor Summary
Constructors Constructor Description HttpClientTransport(TextWireFormat wireFormat, URI remoteUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FutureResponse
asyncRequest(Object command)
protected void
configureMethod(org.apache.http.message.AbstractHttpMessage method)
protected org.apache.http.conn.HttpClientConnectionManager
createClientConnectionManager()
protected org.apache.http.client.HttpClient
createHttpClient()
protected void
doStart()
protected void
doStop(ServiceStopper stopper)
int
getMinSendAsCompressedSize()
X509Certificate[]
getPeerCertificates()
int
getReceiveCounter()
Returns a counter which gets incremented as data is read from the transport.org.apache.http.client.HttpClient
getReceiveHttpClient()
org.apache.http.client.HttpClient
getSendHttpClient()
int
getSoTimeout()
protected String
getSystemPropertyPrefix()
WireFormat
getWireFormat()
Retrieves the WireFormat instance associated with this Transport instance.boolean
isTrace()
boolean
isUseCompression()
void
oneway(Object command)
A one way asynchronous sendObject
request(Object command)
A synchronous request responsevoid
run()
void
setMinSendAsCompressedSize(int minSendAsCompressedSize)
Sets the minimum size that must be exceeded on a send before compression is used if the useCompression option is specified.void
setPeerCertificates(X509Certificate[] certificates)
Sets the certificates provided by the connected peer.void
setReceiveHttpClient(org.apache.http.client.HttpClient receiveHttpClient)
void
setSendHttpClient(org.apache.http.client.HttpClient sendHttpClient)
void
setSoTimeout(int soTimeout)
void
setTrace(boolean trace)
void
setUseCompression(boolean useCompression)
-
Methods inherited from class org.apache.activemq.transport.http.HttpTransportSupport
getProxyHost, getProxyPassword, getProxyPort, getProxyUser, getRemoteAddress, getRemoteUrl, getTextWireFormat, setProxyHost, setProxyPassword, setProxyPort, setProxyUser, setTextWireFormat, toString
-
Methods inherited from class org.apache.activemq.transport.TransportThreadSupport
getStackSize, isDaemon, setDaemon, setStackSize
-
Methods inherited from class org.apache.activemq.transport.TransportSupport
asyncRequest, checkStarted, doConsume, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, onException, reconnect, request, setTransportListener, updateURIs
-
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
-
-
-
-
Field Detail
-
MAX_CLIENT_TIMEOUT
public static final int MAX_CLIENT_TIMEOUT
- See Also:
- Constant Field Values
-
canSendCompressed
protected boolean canSendCompressed
-
-
Constructor Detail
-
HttpClientTransport
public HttpClientTransport(TextWireFormat wireFormat, URI remoteUrl)
-
-
Method Detail
-
asyncRequest
public FutureResponse asyncRequest(Object command) throws IOException
- Throws:
IOException
-
oneway
public void oneway(Object command) throws IOException
Description copied from interface:Transport
A one way asynchronous send- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:Transport
A synchronous request response- Specified by:
request
in interfaceTransport
- Overrides:
request
in classTransportSupport
- Returns:
- the response
- Throws:
IOException
-
run
public void run()
-
getSendHttpClient
public org.apache.http.client.HttpClient getSendHttpClient()
-
setSendHttpClient
public void setSendHttpClient(org.apache.http.client.HttpClient sendHttpClient)
-
getReceiveHttpClient
public org.apache.http.client.HttpClient getReceiveHttpClient()
-
setReceiveHttpClient
public void setReceiveHttpClient(org.apache.http.client.HttpClient receiveHttpClient)
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classTransportThreadSupport
- Throws:
Exception
-
doStop
protected void doStop(ServiceStopper stopper) throws Exception
- Specified by:
doStop
in classServiceSupport
- Throws:
Exception
-
createHttpClient
protected org.apache.http.client.HttpClient createHttpClient()
-
createClientConnectionManager
protected org.apache.http.conn.HttpClientConnectionManager createClientConnectionManager()
-
configureMethod
protected void configureMethod(org.apache.http.message.AbstractHttpMessage method)
-
isTrace
public boolean isTrace()
-
setTrace
public void setTrace(boolean trace)
-
getReceiveCounter
public int getReceiveCounter()
Description copied from interface:Transport
Returns a counter which gets incremented as data is read from the transport. It should only be used to determine if there is progress being made in reading the next command from the transport. The value may wrap into the negative numbers.- Returns:
- a counter which gets incremented as data is read from the transport.
-
getSoTimeout
public int getSoTimeout()
-
setSoTimeout
public void setSoTimeout(int soTimeout)
-
setUseCompression
public void setUseCompression(boolean useCompression)
-
isUseCompression
public boolean isUseCompression()
-
getMinSendAsCompressedSize
public int getMinSendAsCompressedSize()
-
setMinSendAsCompressedSize
public void setMinSendAsCompressedSize(int minSendAsCompressedSize)
Sets the minimum size that must be exceeded on a send before compression is used if the useCompression option is specified. For very small payloads compression can be inefficient compared to the transmission size savings. Default value is 0.- Parameters:
minSendAsCompressedSize
-
-
getPeerCertificates
public X509Certificate[] getPeerCertificates()
- Returns:
- the Certificates provided by the peer, or null if not a secure channel.
-
setPeerCertificates
public void setPeerCertificates(X509Certificate[] certificates)
Description copied from interface:Transport
Sets the certificates provided by the connected peer.- Parameters:
certificates
- the Certificates provided by the peer.
-
getWireFormat
public WireFormat getWireFormat()
Description copied from interface:Transport
Retrieves the WireFormat instance associated with this Transport instance.- Returns:
- the WireFormat in use.
-
getSystemPropertyPrefix
protected String getSystemPropertyPrefix()
- Specified by:
getSystemPropertyPrefix
in classHttpTransportSupport
-
-