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 HTTPTransportwhich uses the Apache HTTP Client library
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancanSendCompressedstatic intMAX_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 FutureResponseasyncRequest(Object command)protected voidconfigureMethod(org.apache.http.message.AbstractHttpMessage method)protected org.apache.http.conn.HttpClientConnectionManagercreateClientConnectionManager()protected org.apache.http.client.HttpClientcreateHttpClient()protected voiddoStart()protected voiddoStop(ServiceStopper stopper)intgetMinSendAsCompressedSize()X509Certificate[]getPeerCertificates()intgetReceiveCounter()Returns a counter which gets incremented as data is read from the transport.org.apache.http.client.HttpClientgetReceiveHttpClient()org.apache.http.client.HttpClientgetSendHttpClient()intgetSoTimeout()protected StringgetSystemPropertyPrefix()WireFormatgetWireFormat()Retrieves the WireFormat instance associated with this Transport instance.booleanisTrace()booleanisUseCompression()voidoneway(Object command)A one way asynchronous sendObjectrequest(Object command)A synchronous request responsevoidrun()voidsetMinSendAsCompressedSize(int minSendAsCompressedSize)Sets the minimum size that must be exceeded on a send before compression is used if the useCompression option is specified.voidsetPeerCertificates(X509Certificate[] certificates)Sets the certificates provided by the connected peer.voidsetReceiveHttpClient(org.apache.http.client.HttpClient receiveHttpClient)voidsetSendHttpClient(org.apache.http.client.HttpClient sendHttpClient)voidsetSoTimeout(int soTimeout)voidsetTrace(boolean trace)voidsetUseCompression(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:TransportA one way asynchronous send- Throws:
IOException
-
request
public Object request(Object command) throws IOException
Description copied from interface:TransportA synchronous request response- Specified by:
requestin interfaceTransport- Overrides:
requestin 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:
doStartin classTransportThreadSupport- Throws:
Exception
-
doStop
protected void doStop(ServiceStopper stopper) throws Exception
- Specified by:
doStopin 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:TransportReturns 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:TransportSets the certificates provided by the connected peer.- Parameters:
certificates- the Certificates provided by the peer.
-
getWireFormat
public WireFormat getWireFormat()
Description copied from interface:TransportRetrieves the WireFormat instance associated with this Transport instance.- Returns:
- the WireFormat in use.
-
getSystemPropertyPrefix
protected String getSystemPropertyPrefix()
- Specified by:
getSystemPropertyPrefixin classHttpTransportSupport
-
-