libnavajo
web server for static and dynamic pages developement in C++
LocalRepository.hh
Go to the documentation of this file.
1 //********************************************************
12 //********************************************************
13 
14 #ifndef LOCALREPOSITORY_HH_
15 #define LOCALREPOSITORY_HH_
16 
17 #include "WebRepository.hh"
18 
19 #include <set>
20 #include <string>
21 #include "libnavajo/nvjThread.h"
22 
23 
25 {
26  pthread_mutex_t _mutex;
27 
28  std::set< std::string > filenamesSet; // list of available files
29  //pair<std::string,std::string> aliasesSet; // alias name | Path to local directory
30  std::string aliasName;
31  std::string fullPathToLocalDir;
32 
33  bool loadFilename_dir(const std::string& alias, const std::string& path, const std::string& subpath="");
34  bool fileExist(const std::string& url);
35 
36 
37  public:
38  LocalRepository (const std::string& alias, const std::string& dirPath);
39  virtual ~LocalRepository () { };
40 
41  virtual bool getFile(HttpRequest* request, HttpResponse *response);
42  virtual void freeFile(unsigned char *webpage) { ::free(webpage); };
43  //void addDirectory(const std::string& alias, const std::string& dirPath);
44  //void clearAliases();
45  void reload();
46  inline std::set< std::string >* getFilenames() { return &filenamesSet; }
47  void printFilenames();
48 };
49 
50 #endif
51 
Definition: WebRepository.hh:21
Web Repository handler (abstract class)
Definition: HttpRequest.hh:42
Definition: LocalRepository.hh:24
Definition: HttpResponse.hh:18
thread&#39;s facilities