Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

ServletConnection.h

00001 /* Copyright (c) 2001-2003 EU DataGrid. */
00002 /* For license conditions see http://www.eu-datagrid.org/license.html */
00003 
00004 #ifndef INFO_SERVLETCONNECTION_H
00005 #define INFO_SERVLETCONNECTION_H
00006 #define OPENSSL_NO_KRB5
00007 #include "rgma/RGMAException.h"
00008 #include "rgma/RemoteException.h"
00009 #include "rgma/SSLContext.h"
00010 #include "log4cxx/logger.h"
00011 #include "log4cxx/level.h"
00012 #include "log4cxx/helpers/loglog.h"
00013 #include "log4cxx/propertyconfigurator.h"
00014 #include "log4cxx/helpers/exception.h"
00015 #include "rgma/Socket.h"
00016 #include <openssl/ssl.h>
00017 #include <string>
00018 
00019 namespace glite
00020 {
00021     namespace rgma
00022     {
00023 
00027         class ServletConnection
00028         {
00029             // This little class chops up URLs
00030 
00031             public:
00032 
00033                 explicit ServletConnection(std::string servletURL) throw (RGMAException);
00034 
00035                 ServletConnection(std::string servletURL, int connectionId) throw (RGMAException);
00036 
00037                 virtual ~ServletConnection();
00038 
00044                 void addParameter(std::string name, std::string value) throw (RGMAException);
00045 
00051                 void addParameter(std::string name, const char* value) throw (RGMAException);
00052 
00058                 void addParameter(std::string name, int value) throw (RGMAException);
00059 
00065                 void addParameter(std::string name, double value) throw (RGMAException);
00066 
00071                 void addParameter(std::string name, bool value) throw (RGMAException);
00072 
00078                 void addParameter(std::string name, long value) throw (RGMAException);
00079 
00090                 void connect(std::string operation,
00091                     std::string& response) throw (RGMAException, RemoteException);
00092 
00093                 int getConnectionId() const;
00094 
00095                 std::string getServletURL() const;
00096 
00097                 std::string toString() const;
00098 
00099             protected:
00105                 std::string getParameters() const { return m_parameters; }
00106 
00107             private:
00111                 void checkURL() const throw (RGMAException);
00112 
00120                 void httpRequest(const std::string url,
00121                     std::string& response) throw (RGMAException, RemoteException);
00122 
00123                 /*
00124                  * Return the HTML document with the HTTP header stripped off, plus any chunking
00125                  * removed.  It assumes that there is no HTTP trailer.
00126                  *
00127                  * @param document HTML document including HTTP header
00128                  * @return HTML document with header stripped off
00129                  */
00130                 std::string stripHeader(std::string document);
00131 
00132                 //static const class APILogging& cat;
00133                 int m_connectionId;
00134                 std::string m_parameters;
00135                 std::string m_servletURL;
00136                 Socket* m_sock;
00137                 bool m_firstConnect;
00138                 log4cxx::LoggerPtr m_logger;
00139 
00140         };
00141 
00142     }                                             // info
00143 }                                                 // edg
00144 #endif                                            // EDG_INFO_SERVLETCONNECTION_H

Generated on Wed May 17 17:48:18 2006 for glite-rgma-api-cpp by doxygen 1.3.5