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"
17
18namespace odil
19{
20
21namespace webservices
22{
23
26{
27public:
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;
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
63private:
64 std::string _method;
65 URL _target;
66 std::string _http_version;
67};
68
71std::istream &
72operator>>(std::istream & stream, HTTPRequest & request);
73
75ODIL_API std::ostream &
76operator<<(std::ostream & stream, HTTPRequest const & request);
77
78}
79
80}
81
82#endif // _a927d586_9154_4f1e_bd56_82f2b6f0450d
HTTP request.
Definition: HTTPRequest.h:26
std::string const & get_http_version() const
Return the HTTP version.
HTTPRequest(HTTPRequest &&)=default
HTTPRequest & operator=(HTTPRequest &&)=default
std::string const & get_method() const
Return the method.
URL const & get_target() const
Return the target.
void set_method(std::string const &method)
Set the method.
HTTPRequest & operator=(HTTPRequest const &)=default
void set_http_version(std::string const &http_version)
Set the HTTP version.
HTTPRequest(std::string const &method="", URL const &target={}, std::string const &http_version="HTTP/1.0", Headers const &headers={}, std::string const &body="")
Constructor.
void set_target(URL const &target)
Set the target.
virtual ~HTTPRequest()=default
HTTPRequest(HTTPRequest const &)=default
RFC 5322 Message (i.e. headers with body).
Definition: Message.h:27
std::istream & operator>>(std::istream &stream, HTTPRequest &request)
Input an HTTP request from a stream.
std::ostream & operator<<(std::ostream &stream, HTTPRequest const &request)
Output an HTTP request to a stream.
Definition: Association.h:25
#define ODIL_API
Definition: odil.h:28
Uniform resource locator.
Definition: URL.h:26