fw4spl
Request.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwNetworkIO/config.hpp"
10 
11 #include <fwCore/base.hpp>
12 
13 #include <map>
14 
15 namespace fwNetworkIO
16 {
17 
18 namespace http
19 {
20 
24 class FWNETWORKIO_CLASS_API Request : public ::fwCore::BaseObject
25 {
26 
27 public:
30 
32  typedef std::map<std::string, std::string> HeadersType;
33 
37  FWNETWORKIO_API Request();
38 
42  FWNETWORKIO_API Request(const std::string& url);
43 
44  virtual ~Request()
45  {
46  }
56  FWNETWORKIO_API static Request::sptr New(const std::string& url);
57 
61  FWNETWORKIO_API void addHeader(const std::string& key, const std::string& value);
62 
66  FWNETWORKIO_API void setHeaders(const HeadersType& headers);
67 
71  FWNETWORKIO_API const HeadersType& getHeaders() const;
72 
76  FWNETWORKIO_API const std::string& getUrl() const;
77 
81  FWNETWORKIO_API void setUrl(const std::string& url);
82 
83 private:
84 
85  HeadersType m_headers;
86 
87  std::string m_url;
88 };
89 
90 } // namespace http
91 
92 }
93 
94 // namespace fwNetworkIO
Base class for all FW4SPL&#39;s classes.
Definition: BaseObject.hpp:22
virtual ~Request()
Construct a new Request with given url.
Definition: Request.hpp:44
The namespace fwNetworkIO contains the primary methods to access network.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
std::map< std::string, std::string > HeadersType
Maps header name to its value.
Definition: Request.hpp:29