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 
30 namespace fawkes {
31 class Logger;
32 class WebUrlManager;
33 class WebReply;
34 class WebRequest;
35 } // namespace fawkes
36 
38 {
39 public:
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 
48 private:
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 
54 private:
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
fawkes::WebRequest
Definition: request.h:41
fawkes::WebUrlManager
Definition: url_manager.h:45
fawkes::Logger
Definition: logger.h:41
fawkes
WebviewStaticRequestProcessor::WebviewStaticRequestProcessor
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.
Definition: static_processor.cpp:59
WebviewStaticRequestProcessor
Definition: static_processor.h:37
WebviewStaticRequestProcessor::~WebviewStaticRequestProcessor
~WebviewStaticRequestProcessor()
Destructor.
Definition: static_processor.cpp:101
fawkes::WebReply
Definition: reply.h:39