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
00107
00108
00109 virtual void setURL (URL& newURL) { realTransportAgent->setURL(newURL); }
00110 virtual void setTimeout (unsigned int t) { realTransportAgent->setTimeout(t); }
00111 virtual void setMaxMsgSize (unsigned int t) { realTransportAgent->setMaxMsgSize(t); }
00112 virtual void setReadBufferSize(unsigned int t) { realTransportAgent->setReadBufferSize(t); }
00113 virtual void setUserAgent(const char* ua) { realTransportAgent->setUserAgent(ua); }
00114 virtual void setCompression(bool newCompression) { realTransportAgent->setCompression(newCompression); }
00115 virtual void setSSLServerCertificates(const char *value){ realTransportAgent->setSSLServerCertificates(value); }
00116 virtual void setSSLVerifyServer(bool value) { realTransportAgent->setSSLVerifyServer(value); }
00117 virtual void setSSLVerifyHost(bool value) { realTransportAgent->setSSLVerifyHost(value); }
00118
00119
00120 private:
00121
00123 TransportAgent* realTransportAgent;
00124
00125 };
00126
00127 END_NAMESPACE
00128
00129 #endif
00130