00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INCL_TRANSPORT_AGENT_REPLACEMENT
00037 #define INCL_TRANSPORT_AGENT_REPLACEMENT
00038
00039
00040 #include "http/constants.h"
00041 #include "http/HTTPHeader.h"
00042 #include "http/TransportAgent.h"
00043 #include "http/TransportAgentFactory.h"
00044 #include "base/util/utils.h"
00045 #include "base/globalsdef.h"
00046
00047 BEGIN_NAMESPACE
00048
00049
00061 class TransportAgentReplacement : public TransportAgent {
00062
00063 protected:
00064
00069 virtual void beforeSendingMessage(StringBuffer& msgToSend) = 0;
00070
00075 virtual void afterReceivingResponse(StringBuffer& msgReceived) = 0;
00076
00077
00078 public:
00079
00083 TransportAgentReplacement();
00084
00088 TransportAgentReplacement(URL& url,
00089 Proxy& proxy,
00090 unsigned int responseTimeout = DEFAULT_MAX_TIMEOUT,
00091 unsigned int maxmsgsize = DEFAULT_MAX_MSG_SIZE);
00092
00096 virtual ~TransportAgentReplacement();
00097
00098
00105 virtual char* sendMessage(const char* msg);
00106
00112 virtual char* sendMessage(const char* data, const unsigned int size);
00113
00114
00115 virtual void setURL (URL& newURL) { realTransportAgent->setURL(newURL); }
00116 virtual void setTimeout (unsigned int t) { realTransportAgent->setTimeout(t); }
00117 virtual void setMaxMsgSize (unsigned int t) { realTransportAgent->setMaxMsgSize(t); }
00118 virtual void setReadBufferSize(unsigned int t) { realTransportAgent->setReadBufferSize(t); }
00119 virtual void setUserAgent(const char* ua) { realTransportAgent->setUserAgent(ua); }
00120 virtual void setCompression(bool newCompression) { realTransportAgent->setCompression(newCompression); }
00121 virtual void setSSLServerCertificates(const char *value){ realTransportAgent->setSSLServerCertificates(value); }
00122 virtual void setSSLVerifyServer(bool value) { realTransportAgent->setSSLVerifyServer(value); }
00123 virtual void setSSLVerifyHost(bool value) { realTransportAgent->setSSLVerifyHost(value); }
00124
00125
00126 private:
00127
00129 TransportAgent* realTransportAgent;
00130
00131 };
00132
00133 END_NAMESPACE
00134
00135 #endif
00136