]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/httpresponse.h
Se actualiza documentacion:
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / httpresponse.h
index 936d2a35e0473d6e0b31c7f35f9a308d1a448ac8..09ff21d02d7f5b849cb7aa2183e95a481934082e 100644 (file)
@@ -28,7 +28,9 @@
 #ifndef PLAQUI_HTTPRESPONSE_H
 #define PLAQUI_HTTPRESPONSE_H
 
 #ifndef PLAQUI_HTTPRESPONSE_H
 #define PLAQUI_HTTPRESPONSE_H
 
-#include "httpmessage.h"
+#include "plaqui/server/httperror.h"
+#include "plaqui/server/httpmessage.h"
+#include <socket++/sockstream.h>
 #include <string>
 
 namespace PlaQui {
 #include <string>
 
 namespace PlaQui {
@@ -38,9 +40,23 @@ namespace Server {
        /// Respuesta HTTP.
        class HTTPResponse: public HTTPMessage {
 
        /// Respuesta HTTP.
        class HTTPResponse: public HTTPMessage {
 
+               /////////////////////////////////////////////////////////////////////
+               // Tipos.
+
+               public:
+
+                       typedef enum {
+                               INVALID_HTTP_RESPONSE,
+                               INVALID_HTTP_VERSION,
+                               INVALID_HTTP_RESPONSE_CODE,
+                               MISSING_HTTP_RESPONSE_CODE
+                       } Error;
+
+               /////////////////////////////////////////////////////////////////////
                // Atributos.
 
                // Atributos.
 
-               protected:
+               //protected: FIXME - hacer privado con get/set?
+               public:
 
                        /// Código de estado.
                        unsigned status_code;
 
                        /// Código de estado.
                        unsigned status_code;
@@ -48,6 +64,7 @@ namespace Server {
                        /// Descripción del código (razón).
                        std::string reason;
 
                        /// Descripción del código (razón).
                        std::string reason;
 
+               /////////////////////////////////////////////////////////////////////
                // Métodos.
 
                public:
                // Métodos.
 
                public:
@@ -60,38 +77,38 @@ namespace Server {
                        /**
                         * Constructor.
                         */
                        /**
                         * Constructor.
                         */
-                       HTTPResponse(const std::string& version = "1.1");
+                       HTTPResponse(const std::string& body = "",
+                                       const std::string& version = "1.1");
 
                        /**
                         * Constructor.
                         */
 
                        /**
                         * Constructor.
                         */
-                       HTTPResponse(const Serializable& body,
-                                       const std::string& version = "1.1");
+                       HTTPResponse(const HTTPError& error);
 
                        /**
                         * Constructor.
                         */
 
                        /**
                         * Constructor.
                         */
-                       HTTPResponse(unsigned status_code, const std::string& reason,
-                                       const std::string& version = "1.1");
+                       HTTPResponse(unsigned status_code, const std::string& body = "");
 
                        /**
                         * Constructor.
                         */
 
                        /**
                         * Constructor.
                         */
-                       HTTPResponse(unsigned status_code, const std::string& reason,
-                                       const std::string& body,
-                                       const std::string& version = "1.1");
+                       //HTTPResponse(unsigned status_code, const std::string& reason,
+                       //              const std::string& body,
+                       //              const std::string& version = "1.1");
 
                        /**
                         * Obtiene los datos de la respuesta HTTP desde un texto.
                         */
                        friend std::istream& operator>>(std::istream& is,
 
                        /**
                         * Obtiene los datos de la respuesta HTTP desde un texto.
                         */
                        friend std::istream& operator>>(std::istream& is,
-                                       const HTTPResponse& resp);
+                                       HTTPResponse& resp)
+                               throw(Error, sockerr, std::ios::failure);
 
                        /**
                         * Convierte la respuesta HTTP en texto.
                         */
                        friend std::ostream& operator<<(std::ostream& os,
 
                        /**
                         * Convierte la respuesta HTTP en texto.
                         */
                        friend std::ostream& operator<<(std::ostream& os,
-                                       const HTTPResponse& resp);
+                                       const HTTPResponse& resp) throw(sockerr);
 
        };
 
 
        };