Odil
A C++11 library for the DICOM standard
HTTPRequest.h
Go to the documentation of this file.
1 /*************************************************************************
2  * odil - Copyright (C) Universite de Strasbourg
3  * Distributed under the terms of the CeCILL-B license, as published by
4  * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
5  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
6  * for details.
7  ************************************************************************/
8 
9 #ifndef _a927d586_9154_4f1e_bd56_82f2b6f0450d
10 #define _a927d586_9154_4f1e_bd56_82f2b6f0450d
11 
12 #include <string>
13 
14 #include "odil/odil.h"
16 #include "odil/webservices/URL.h"
17 
18 namespace odil
19 {
20 
21 namespace webservices
22 {
23 
26 {
27 public:
35  std::string const & method="", URL const & target={},
36  std::string const & http_version="HTTP/1.0",
37  Headers const & headers={}, std::string const & body="");
38 
39  HTTPRequest(HTTPRequest const &) = default;
40  HTTPRequest(HTTPRequest &&) = default;
41  HTTPRequest & operator=(HTTPRequest const &) = default;
42  HTTPRequest & operator=(HTTPRequest &&) = default;
43  virtual ~HTTPRequest() = default;
44 
46  std::string const & get_method() const;
47 
49  void set_method(std::string const & method);
50 
52  URL const & get_target() const;
53 
55  void set_target(URL const & target);
56 
58  std::string const & get_http_version() const;
59 
61  void set_http_version(std::string const & http_version);
62 
63 private:
64  std::string _method;
65  URL _target;
66  std::string _http_version;
67 };
68 
71 std::istream &
72 operator>>(std::istream & stream, HTTPRequest & request);
73 
75 ODIL_API std::ostream &
76 operator<<(std::ostream & stream, HTTPRequest const & request);
77 
78 }
79 
80 }
81 
82 #endif // _a927d586_9154_4f1e_bd56_82f2b6f0450d
std::ostream & operator<<(std::ostream &stream, HTTPRequest const &request)
Output an HTTP request to a stream.
HTTP request.
Definition: HTTPRequest.h:25
RFC 5322 Message (i.e. headers with body).
Definition: Message.h:26
Definition: Association.h:24
Uniform resource locator.
Definition: URL.h:25
std::map< std::string, std::string > Headers
Associative container for headers.
Definition: Message.h:30
#define ODIL_API
Definition: odil.h:28
std::istream & operator>>(std::istream &stream, HTTPRequest &request)
Input an HTTP request from a stream.