client-cpp  0.6.1
MultipartPostHttpRequest.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MULTIPARTPOSTHTTPREQUEST_HPP_
18 #define MULTIPARTPOSTHTTPREQUEST_HPP_
19 
20 #include "kaa/KaaDefaults.hpp"
21 
22 #if defined(KAA_DEFAULT_BOOTSTRAP_HTTP_CHANNEL) || \
23  defined(KAA_DEFAULT_OPERATION_HTTP_CHANNEL) || \
24  defined(KAA_DEFAULT_LONG_POLL_CHANNEL)
25 
27 #include "kaa/http/HttpUrl.hpp"
28 
29 #include <map>
30 #include <vector>
31 
32 namespace kaa {
33 
34 class MultipartPostHttpRequest : public IHttpRequest {
35 public:
36  MultipartPostHttpRequest(const HttpUrl& url);
37  virtual ~MultipartPostHttpRequest();
38 
39  virtual std::string getHost() const;
40  virtual std::uint16_t getPort() const;
41  virtual std::string getRequestData() const;
42  virtual void setHeaderField(const std::string& name, const std::string& value);
43  virtual void removeHeaderField(const std::string& name);
44 
45  void setBodyField(const std::string& name, const std::vector<std::uint8_t>& value);
46  void removeBodyField(const std::string& name);
47 
48 private:
49  static const std::string BOUNDARY;
50 
51 private:
52  HttpUrl url_;
53  std::map<std::string, std::string> headerFields_;
54  std::map<std::string, std::vector<std::uint8_t>> bodyFields_;
55 };
56 
57 }
58 
59 #endif
60 
61 #endif /* MULTIPARTPOSTHTTPREQUEST_HPP_ */