HttpServerConfiguration.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2017 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_NETWORK_HTTP_SERVER__HTTP_SERVER_CONFIGURATION
18 #define COM_BORA_SOFTWARE__BALAU_NETWORK_HTTP_SERVER__HTTP_SERVER_CONFIGURATION
19 
22 #include <Balau/Application/Impl/BindingKey.hpp>
23 #include <Balau/Logging/Impl/BalauLogger.hpp>
24 
25 namespace Balau {
26 
27 class EnvironmentProperties;
28 class Injector;
29 
30 namespace System {
31 
32 class Clock;
33 
34 } // namespace System
35 
36 namespace Network::Http {
37 
38 class HttpWebApp;
39 class WsWebApp;
40 
48  const std::shared_ptr<const System::Clock> clock;
49 
56  const std::shared_ptr<EnvironmentProperties> configuration;
57 
61  const BalauLogger logger;
62 
66  const std::string serverId;
67 
71  const TCP::endpoint endpoint;
72 
76  const std::string sessionCookieName;
77 
81  const std::shared_ptr<HttpWebApp> httpHandler;
82 
86  const std::shared_ptr<WsWebApp> wsHandler;
87 
91  const std::shared_ptr<MimeTypes> mimeTypes;
92 
94 
95  HttpServerConfiguration(std::shared_ptr<const System::Clock> clock_,
96  const BalauLogger & logger_,
97  std::string serverIdentification_,
98  TCP::endpoint endpoint_,
99  std::string sessionCookieName_,
100  std::shared_ptr<HttpWebApp> httpHandler_,
101  std::shared_ptr<WsWebApp> wsHandler_,
102  std::shared_ptr<MimeTypes> mimeTypes_)
103  : clock(std::move(clock_))
104  , logger(logger_)
105  , serverId(std::move(serverIdentification_))
106  , endpoint(std::move(endpoint_))
107  , sessionCookieName(std::move(sessionCookieName_))
108  , httpHandler(std::move(httpHandler_))
109  , wsHandler(std::move(wsHandler_))
110  , mimeTypes(std::move(mimeTypes_)) {}
111 };
112 
113 } // namespace Network::Http
114 
115 } // namespace Balau
116 
117 #endif // COM_BORA_SOFTWARE__BALAU_NETWORK_HTTP_SERVER__HTTP_SERVER_CONFIGURATION
const std::shared_ptr< const System::Clock > clock
The clock used by the server.
Definition: HttpServerConfiguration.hpp:48
const TCP::endpoint endpoint
The IP address and port on which the server is listening.
Definition: HttpServerConfiguration.hpp:71
Low level types used in networking code.
Base interface of clocks.
Definition: Clock.hpp:47
const BalauLogger logger
The main logger into which the server will log.
Definition: HttpServerConfiguration.hpp:61
Shared state between HTTP sessions.
Definition: HttpServerConfiguration.hpp:44
const std::shared_ptr< HttpWebApp > httpHandler
The handler implementation used to handle HTTP messages.
Definition: HttpServerConfiguration.hpp:81
const std::shared_ptr< WsWebApp > wsHandler
The handler implementation used to handle WebSocket messages.
Definition: HttpServerConfiguration.hpp:86
STL namespace.
const std::string sessionCookieName
The name of the cookie where the client session id is stored.
Definition: HttpServerConfiguration.hpp:76
The root Balau namespace.
Definition: ApplicationConfiguration.hpp:23
const std::shared_ptr< MimeTypes > mimeTypes
The map of registered mime types.
Definition: HttpServerConfiguration.hpp:91
Mime type utilities.
const std::string serverId
The server identification string.
Definition: HttpServerConfiguration.hpp:66
const std::shared_ptr< EnvironmentProperties > configuration
The Http server&#39;s environment configuration.
Definition: HttpServerConfiguration.hpp:56