fw4spl
Request.cpp
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 #include "fwNetworkIO/http/Request.hpp"
8 
9 namespace fwNetworkIO
10 {
11 
12 namespace http
13 {
14 
16 {
17 }
18 
19 Request::Request(const std::string& url) :
20  m_url(url)
21 {
22 }
23 
24 //------------------------------------------------------------------------------
25 
26 Request::sptr Request::New(const std::string& url)
27 {
28  return std::make_shared<Request>(url);
29 }
30 
31 //------------------------------------------------------------------------------
32 
33 void Request::addHeader(const std::string& key, const std::string& value)
34 {
35  m_headers[key] = value;
36 }
37 
38 //------------------------------------------------------------------------------
39 
40 void Request::setHeaders(const HeadersType& headers)
41 {
42  m_headers = headers;
43 }
44 
45 //------------------------------------------------------------------------------
46 
48 {
49  return m_headers;
50 }
51 
52 //------------------------------------------------------------------------------
53 
54 const std::string& Request::getUrl() const
55 {
56  return m_url;
57 }
58 
59 //------------------------------------------------------------------------------
60 
61 void Request::setUrl(const std::string& url)
62 {
63  m_url = url;
64 }
65 
66 } // namespace http
67 } // namespace fwNetworkIO
static FWNETWORKIO_API Request::sptr New(const std::string &url)
Creates a new Request with given url.
Definition: Request.cpp:26
FWNETWORKIO_API const HeadersType & getHeaders() const
headers getter.
Definition: Request.cpp:47
The namespace fwNetworkIO contains the primary methods to access network.
FWNETWORKIO_API void setHeaders(const HeadersType &headers)
headers setter.
Definition: Request.cpp:40
FWNETWORKIO_API void setUrl(const std::string &url)
set current url
Definition: Request.cpp:61
FWNETWORKIO_API void addHeader(const std::string &key, const std::string &value)
add element in the request header
Definition: Request.cpp:33
FWNETWORKIO_API const std::string & getUrl() const
return current url
Definition: Request.cpp:54
std::map< std::string, std::string > HeadersType
Maps header name to its value.
Definition: Request.hpp:29
FWNETWORKIO_API Request()
Construct a new Request with given url.
Definition: Request.cpp:15