UniSet 2.41.2
UHttpServer.h
1#ifndef DISABLE_REST_API
2/*
3 * Copyright (c) 2015 Pavel Vainerman.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation, version 2.1.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Lesser Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17// -------------------------------------------------------------------------
18#ifndef UHttpServer_H_
19#define UHttpServer_H_
20// -------------------------------------------------------------------------
21#include <string>
22#include <memory>
23#include <Poco/Net/HTTPServer.h>
24#include "DebugStream.h"
25#include "ThreadCreator.h"
26#include "UHttpRequestHandler.h"
27// -------------------------------------------------------------------------
31// -------------------------------------------------------------------------
32namespace uniset
33{
34 namespace UHttp
35 {
37 {
38 public:
39
40 UHttpServer( std::shared_ptr<IHttpRequestRegistry>& supplier, const std::string& host, int port );
41 virtual ~UHttpServer();
42
43 void start();
44 void stop();
45
46 std::shared_ptr<DebugStream> log();
47
48 // (CORS): Access-Control-Allow-Origin. Default: *
49 void setCORS_allow( const std::string& CORS_allow );
50 void setDefaultContentType( const std::string& ct);
51 protected:
53
54 private:
55
56 std::shared_ptr<DebugStream> mylog;
57 Poco::Net::SocketAddress sa;
58
59 std::shared_ptr<Poco::Net::HTTPServer> http;
60 std::shared_ptr<UHttpRequestHandlerFactory> reqFactory;
61
62 };
63 }
64}
65// -------------------------------------------------------------------------
66#endif // UHttpServer_H_
67// -------------------------------------------------------------------------
68#endif
UHttpServer(std::shared_ptr< IHttpRequestRegistry > &supplier, const std::string &host, int port)
Определения UHttpServer.cc:30
Определения Calibration.h:27