root/http/templated_resource.hh

Revision cc0a570a9262613f7046938be649f27646987cb8, 2.0 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 2 years ago)

Add support for Atom feeds, and implement a group feed

Partially addresses #8

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1/*  This file is part of Alue, the multiprotocol Internet discussion daemon
2
3    Copyright © 2009 Antti-Juhani Kaijanaho
4
5    Alue is free software: you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    Alue is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with Alue.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20#ifndef GUARD_HTTP_TEMPLATED_RESOURCE_HH
21#define GUARD_HTTP_TEMPLATED_RESOURCE_HH
22
23#include "resource.hh"
24#include "resource_exception.hh"
25
26#include "../tlate/data_model.hh"
27#include "../tlate/tlate.hh"
28#include "../server.hh"
29
30#include <list>
31
32namespace http
33{
34        class session;
35        class templated_resource : public resource
36        {
37                std::string rl;
38                boost::shared_ptr<tlate::tlate> tl;
39                std::list<std::pair<std::string,std::string> > flds;
40
41        protected:
42                server::conn_cb cb;
43                virtual void set_attributes(boost::shared_ptr<request>,
44                                            tlate::data_model::ptr)
45                        {}
46        public:
47                templated_resource(server::conn_cb cb, std::string path,
48                                   std::string rl = "200 Ok");
49                virtual ~templated_resource() {}
50
51                void add_header(std::string name, std::string body) {
52                        flds.push_back(std::make_pair(name, body));
53                }
54
55                boost::shared_ptr<response> operator()
56                (boost::shared_ptr<request>, response::factory);
57        };
58}
59
60#endif /* GUARD_HTTP_TEMPLATED_RESOURCE_HH */
Note: See TracBrowser for help on using the browser.