comparison Core/HttpServer/MongooseServer.h @ 1443:895ab369d63c

refactoring: OrthancHttpHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 11:30:19 +0200
parents f3672356c121
children 4f8c8ef114db
comparison
equal deleted inserted replaced
1442:4ff8dd753d79 1443:895ab369d63c
57 const char* username) const = 0; 57 const char* username) const = 0;
58 }; 58 };
59 59
60 class MongooseServer 60 class MongooseServer
61 { 61 {
62 public:
63 typedef std::list<IHttpHandler*> Handlers;
64
65 private: 62 private:
66 // http://stackoverflow.com/questions/311166/stdauto-ptr-or-boostshared-ptr-for-pimpl-idiom 63 // http://stackoverflow.com/questions/311166/stdauto-ptr-or-boostshared-ptr-for-pimpl-idiom
67 struct PImpl; 64 struct PImpl;
68 boost::shared_ptr<PImpl> pimpl_; 65 boost::shared_ptr<PImpl> pimpl_;
69 66
70 Handlers handlers_; 67 IHttpHandler *handler_;
71 68
72 typedef std::set<std::string> RegisteredUsers; 69 typedef std::set<std::string> RegisteredUsers;
73 RegisteredUsers registeredUsers_; 70 RegisteredUsers registeredUsers_;
74 71
75 bool remoteAllowed_; 72 bool remoteAllowed_;
100 97
101 void ClearUsers(); 98 void ClearUsers();
102 99
103 void RegisterUser(const char* username, 100 void RegisterUser(const char* username,
104 const char* password); 101 const char* password);
105
106 void RegisterHandler(IHttpHandler& handler);
107 102
108 bool IsAuthenticationEnabled() const 103 bool IsAuthenticationEnabled() const
109 { 104 {
110 return authentication_; 105 return authentication_;
111 } 106 }
145 return filter_; 140 return filter_;
146 } 141 }
147 142
148 void SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter); 143 void SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter);
149 144
150 void ClearHandlers();
151
152 ChunkStore& GetChunkStore(); 145 ChunkStore& GetChunkStore();
153 146
154 bool IsValidBasicHttpAuthentication(const std::string& basic) const; 147 bool IsValidBasicHttpAuthentication(const std::string& basic) const;
155 148
156 const Handlers& GetHandlers() const 149 void Register(IHttpHandler& handler);
150
151 bool HasHandler() const
157 { 152 {
158 return handlers_; 153 return handler_ != NULL;
159 } 154 }
155
156 IHttpHandler& GetHandler() const;
160 }; 157 };
161 } 158 }