Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
HTTPResponse.h
1/*=======================================================================
2*** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3*** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4*** ***
5*** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6*** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7*** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8*** ***
9*** RESTRICTED RIGHTS LEGEND ***
10*** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11*** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12*** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13*** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14*** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15*** ***
16*** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17*** BORDEAUX, FRANCE ***
18*** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20
21#pragma once
22
23#include <Inventor/sys/port.h>
24#include <RemoteViz/Rendering/LibHelper.h>
25
26#include <memory>
27#include <string>
28
29namespace RemoteViz
30{
31 namespace Rendering
32 {
33 class HTTPResponseImpl;
34 class HTTPHeaders;
35
49 class RENDERSERVICE_API HTTPResponse
50 {
51 public:
52
57 {
58 UNKNOWN = 0,
59
60 /* 1xx - Informational */
61 CONTINUE = 100,
62 SWITCHING_PROTOCOLS = 101,
63 PROCESSING = 102,
64 EARLY_HINTS = 103,
65
66 /* 2xx - Successful */
67 OK = 200,
68 CREATED = 201,
69 ACCEPTED = 202,
70 NON_AUTHORITATIVE_INFORMATION = 203,
71 NO_CONTENT = 204,
72 RESET_CONTENT = 205,
73 PARTIAL_CONTENT = 206,
74 MULTI_STATUS = 207,
75 ALREADY_REPORTED = 208,
76 IM_USED = 226,
77
78 /* 3xx - Redirection */
79 MULTIPLE_CHOICES = 300,
80 MOVED_PERMANENTLY = 301,
81 FOUND = 302,
82 SEE_OTHER = 303,
83 NOT_MODIFIED = 304,
84 USE_PROXY = 305,
85 TEMPORARY_REDIRECT = 307,
86 PERMANENT_REDIRECT = 308,
87
88 /* 4xx - Client Error */
89 BAD_REQUEST = 400,
90 UNAUTHORIZED = 401,
91 PAYMENT_REQUIRED = 402,
92 FORBIDDEN = 403,
93 NOT_FOUND = 404,
94 METHOD_NOT_ALLOWED = 405,
95 NOT_ACCEPTABLE = 406,
96 PROXY_AUTHENTICATION_REQUIRED = 407,
97 REQUEST_TIMEOUT = 408,
98 CONFLICT = 409,
99 GONE = 410,
100 LENGTH_REQUIRED = 411,
101 PRECONDITION_FAILED = 412,
102 PAYLOAD_TOO_LARGE = 413,
103 URI_TOO_LONG = 414,
104 UNSUPPORTED_MEDIA_TYPE = 415,
105 RANGE_NOT_SATISFIABLE = 416,
106 EXPECTATION_FAILED = 417,
107 MISDIRECTED_REQUEST = 421,
108 UNPROCESSABLE_ENTITY = 422,
109 LOCKED = 423,
110 FAILED_DEPENDENCY = 424,
111 UPGRADE_REQUIRED = 426,
112 PRECONDITION_REQUIRED = 428,
113 TOO_MANY_REQUESTS = 429,
114 REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
115 CONNECTION_CLOSED_WITHOUT_RESPONSE = 444,
116 UNAVAILABLE_FOR_LEGAL_REASONS = 451,
117 CLIENT_CLOSED_REQUEST = 499,
118
119 /* 5xx - Server Error */
120 INTERNAL_SERVER_ERROR = 500,
121 NOT_IMPLEMENTED = 501,
122 BAD_GATEWAY = 502,
123 SERVICE_UNAVAILABLE = 503,
124 GATEWAY_TIMEOUT = 504,
125 HTTP_VERSION_NOT_SUPPORTED = 505,
126 VARIANT_ALSO_NEGOTIATES = 506,
127 INSUFFICIENT_STORAGE = 507,
128 LOOP_DETECTED = 508,
129 NOT_EXTENDED = 510,
130 NETWORK_AUTHENTICATION_REQUIRED = 511,
131 NETWORK_CONNECT_TIMEOUT_ERROR = 599
132 };
133
138
143
147 HTTPResponse(HTTPStatus statusCode, const std::string& reason);
148
152 HTTPResponse(HTTPStatus statusCode, const std::string& reason, const std::string& body);
153
157 HTTPResponse(HTTPStatus statusCode, const std::string& reason, const std::string& body, int versionMajor, int versionMinor, const HTTPHeaders& headers);
158
163
168
173
178
182 const std::string& getReason() const;
183
185
188 const std::string& getVersion() const;
189
194 int getVersionMajor() const;
195
200 int getVersionMinor() const;
202
207 const std::string& getBody() const;
208
212 int64_t getContentLength() const;
213
217 const HTTPHeaders& getHeaders() const;
218
222 static std::string getReasonPhrase(HTTPStatus status);
223
224 private:
227 std::shared_ptr<HTTPResponseImpl> getImpl() const;
230 private:
232 std::shared_ptr<HTTPResponseImpl> pImpl;
233
234 };
235
236 }
237}
<a href="IconLegend.html"><img src="extRV.gif" alt="RemoteViz" border="0"></a>
Definition HTTPHeaders.h:49
<a href="IconLegend.html"><img src="extRV.gif" alt="RemoteViz" border="0"></a>
HTTPResponse & operator=(const HTTPResponse &obj)
Copy assignment operator.
HTTPResponse(HTTPStatus statusCode, const std::string &reason)
Creates a HTTP/1.1 response with the given status and reason phrase.
int getVersionMajor() const
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.
HTTPResponse(HTTPStatus statusCode, const std::string &reason, const std::string &body)
Creates a HTTP/1.1 response with the given status, reason phrase and message body data.
HTTPResponse(HTTPStatus statusCode, const std::string &reason, const std::string &body, int versionMajor, int versionMinor, const HTTPHeaders &headers)
Creates a HTTP response with the given status, reason phrase, message body data, version and headers.
HTTPStatus getStatusCode() const
Returns the HTTP status.
HTTPResponse(HTTPStatus statusCode)
Creates a HTTP/1.1 response with the given status and a standard reason phrase.
const std::string & getVersion() const
Returns the HTTP version for incoming request (example "HTTP/1.1").
HTTPResponse()
Creates a HTTP/1.1 response with "200 OK" status.
HTTPResponse(const HTTPResponse &obj)
Copy constructor.
const std::string & getReason() const
Returns the HTTP reason phrase.
int getVersionMinor() const
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.
static std::string getReasonPhrase(HTTPStatus status)
Returns the standard HTTP reason phrase for a HTTP status code.
int64_t getContentLength() const
Returns the size of the body, in bytes (Content-Length entity header)
HTTPStatus
Enum for the HTTP status codes.
const HTTPHeaders & getHeaders() const
Returns HTTP headers.
const std::string & getBody() const
Returns the HTTP message body data (optional).