Webdar 1.0.0
Web user interface to libdar
error_page.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef ERROR_PAGE_HPP
25#define ERROR_PAGE_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35
36 // webdar headers
37#include "responder.hpp"
38#include "html_page.hpp"
39#include "html_text.hpp"
40#include "html_static_url.hpp"
41#include "html_form_input.hpp"
42#include "html_form.hpp"
43#include "html_div.hpp"
44
46
47class error_page : public responder
48{
49public:
50 error_page(unsigned int status_code,
51 const std::string & reason);
52
53 void set_message_body(const std::string & message);
54 void set_return_uri(const uri &ref, const std::string & label);
55
57 answer give_answer(const request & req) override;
58
59protected:
60 virtual void prefix_has_changed() override;
61
62private:
63 unsigned int status; //< return code of the answer (seen by browser, rarely visibile by the user)
64 std::string msg; //< returned reason of the answer ( seen by browser, rarely visibile by the user)
65
66 // body_builder objects
67 html_page page; //< html construction primitive
68 html_div div; //< construction object containing both body and text
69 html_text body; //< message displayed to the user set by 'set_message_body()'
70 html_text text; //< used to build the return path in HTML body
71
72 void field_delete();
73};
74
75
76#endif
class answer provides easy means to set an HTTP answer and means to sent it back to a proto_connexion...
Definition: answer.hpp:49
responds a error message to the user as defined by auxiliary methods
Definition: error_page.hpp:48
virtual void prefix_has_changed() override
hook for inherited class, when the body builder object had its prefix changed
Definition: error_page.cpp:123
answer give_answer(const request &req) override
inherited from responder
Definition: error_page.cpp:112
class html_div is the implementation of
Definition: html_div.hpp:46
html page root component
Definition: html_page.hpp:45
class html_text manage text and header in html document
Definition: html_text.hpp:52
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
pure virtual class, base class for all classes that can generate an answer to a request
Definition: responder.hpp:46
uri type holds the splitted list of the scheme / hostname / path # anchor
Definition: uri.hpp:44