Fawkes API Fawkes Development Version
static_processor.h
1
2/***************************************************************************
3 * static_processor.h - Web request processor for static files
4 *
5 * Created: Mon Oct 13 23:41:34 2008
6 * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_WEBVIEW_STATIC_PROCESSOR_H_
24#define _PLUGINS_WEBVIEW_STATIC_PROCESSOR_H_
25
26#include <map>
27#include <string>
28#include <vector>
29
30namespace fawkes {
31class Logger;
32class WebUrlManager;
33class WebReply;
34class WebRequest;
35} // namespace fawkes
36
38{
39public:
41 const std::string & base_url,
42 std::vector<std::string> &htdocs_dir,
43 const std::string & catchall_file,
44 const std::string & mime_file,
45 fawkes::Logger * logger);
47
48private:
49 fawkes::WebReply * process_request(const fawkes::WebRequest *request);
50 std::string find_file(const std::string &filename);
51 void read_mime_database(const std::string &mime_file);
52 const std::string &get_mime_type(const std::string &file_name);
53
54private:
55 std::vector<std::string> htdocs_dirs_;
56
57 fawkes::Logger * logger_;
58 fawkes::WebUrlManager *url_manager_;
59
60 std::map<std::string, std::string> mime_types_;
61
62 std::string base_url_;
63 std::string catchall_file_;
64};
65
66#endif
Static file web processor.
WebviewStaticRequestProcessor(fawkes::WebUrlManager *url_manager, const std::string &base_url, std::vector< std::string > &htdocs_dir, const std::string &catchall_file, const std::string &mime_file, fawkes::Logger *logger)
Constructor.
Interface for logging.
Definition: logger.h:42
Basic web reply.
Definition: reply.h:34
Web request meta data carrier.
Definition: request.h:42
Manage URL mappings.
Definition: url_manager.h:40
Fawkes library namespace.