Remove dynamic exceptions
[anna.git] / include / anna / http / http.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef anna_http_http_hpp
10 #define anna_http_http_hpp
11
12 namespace anna {
13
14 /**
15    Proporciona los componentes necesarios para la comunicacion entre procesos usando como
16    capa de transporte el protocolo HTTP 1.1 definido en el RFC 2616.
17
18    A continacion mostramos la forma en la que se podria definir un ServerSocket que atiende peticiones y/o respuesta
19    sobre el protocolo HTTP.
20
21    \code
22    void MyHTTPServer::initialize ()
23       noexcept(false)
24    {
25       CommandLine& cl (CommandLine::instantiate ());
26
27       int port = cl.getIntegerValue ("p");
28       const comm::Device* device = Network::instantiate ().find (Device::asAddress (cl.getValue ("a")));
29
30       a_serverSocket = new ServerSocket (INetAddress (device, port), cl.exists ("r"), &anna::http::Transport::getFactory ());
31    }
32    \endcode
33
34    El siguiente ejemplo muestra como podriamos definir un cliente HTTP que realiza las peticiones sobre un servidor
35    HTTP:
36
37    \code
38    void MyHTTPClient::initialize ()
39       noexcept(false)
40    {
41       CommandLine& cl (CommandLine::instantiate ());
42
43       Network& network = Network::instantiate ();
44
45       Host* host = network.find ("host000");
46       host->assign (network.find (Device::asAddress (cl.getValue ("a"))));
47       a_server = host->createServer ("http_server", cl.getIntegerValue ("p"), true, &anna::http::Transport::getFactory ());
48    }
49    \endcode
50
51    El ejecutable debera enlazarse con las librerias:
52       \li libanna.core.a
53       \li libanna.xml.a
54       \li libanna.app.a
55       \li libanna.comm.a
56       \li libanna.http.a
57
58    El <b>Packet Header</b> es anna.http.h
59 */
60 namespace http {
61 }
62
63 }
64
65 #include <anna.http.functions.h>
66 #include <anna.http.Handler.h>
67 #include <anna.http.Header.h>
68 #include <anna.http.MessageFactory.h>
69 #include <anna.http.Message.h>
70 #include <anna.http.Method.h>
71 #include <anna.http.Request.h>
72 #include <anna.http.Response.h>
73 #include <anna.http.Transport.h>
74
75 using namespace anna::http;
76
77 #endif
78