00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #pragma once
00022 
00023 #include <Inventor/sys/port.h>
00024 #include <RemoteViz/Rendering/LibHelper.h>
00025 
00026 #include <memory>
00027 #include <string>
00028 
00029 namespace RemoteViz
00030 {
00031   namespace Rendering
00032   {
00033     class HTTPResponseImpl;
00034     class HTTPHeaders;
00035 
00049     class RENDERSERVICE_API HTTPResponse
00050     {
00051     public:
00052 
00056       enum HTTPStatus
00057       {
00058         UNKNOWN = 0,
00059 
00060         
00061         CONTINUE = 100,
00062         SWITCHING_PROTOCOLS = 101,
00063         PROCESSING = 102,
00064         EARLY_HINTS = 103,
00065 
00066         
00067         OK = 200,
00068         CREATED = 201,
00069         ACCEPTED = 202,
00070         NON_AUTHORITATIVE_INFORMATION = 203,
00071         NO_CONTENT = 204,
00072         RESET_CONTENT = 205,
00073         PARTIAL_CONTENT = 206,
00074         MULTI_STATUS = 207,
00075         ALREADY_REPORTED = 208,
00076         IM_USED = 226,
00077 
00078         
00079         MULTIPLE_CHOICES = 300,
00080         MOVED_PERMANENTLY = 301,
00081         FOUND = 302,
00082         SEE_OTHER = 303,
00083         NOT_MODIFIED = 304,
00084         USE_PROXY = 305,
00085         TEMPORARY_REDIRECT = 307,
00086         PERMANENT_REDIRECT = 308,
00087 
00088         
00089         BAD_REQUEST = 400,
00090         UNAUTHORIZED = 401,
00091         PAYMENT_REQUIRED = 402,
00092         FORBIDDEN = 403,
00093         NOT_FOUND = 404,
00094         METHOD_NOT_ALLOWED = 405,
00095         NOT_ACCEPTABLE = 406,
00096         PROXY_AUTHENTICATION_REQUIRED = 407,
00097         REQUEST_TIMEOUT = 408,
00098         CONFLICT = 409,
00099         GONE = 410,
00100         LENGTH_REQUIRED = 411,
00101         PRECONDITION_FAILED = 412,
00102         PAYLOAD_TOO_LARGE = 413,
00103         URI_TOO_LONG = 414,
00104         UNSUPPORTED_MEDIA_TYPE = 415,
00105         RANGE_NOT_SATISFIABLE = 416,
00106         EXPECTATION_FAILED = 417,
00107         MISDIRECTED_REQUEST = 421,
00108         UNPROCESSABLE_ENTITY = 422,
00109         LOCKED = 423,
00110         FAILED_DEPENDENCY = 424,
00111         UPGRADE_REQUIRED = 426,
00112         PRECONDITION_REQUIRED = 428,
00113         TOO_MANY_REQUESTS = 429,
00114         REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
00115         CONNECTION_CLOSED_WITHOUT_RESPONSE = 444,
00116         UNAVAILABLE_FOR_LEGAL_REASONS = 451,
00117         CLIENT_CLOSED_REQUEST = 499,
00118 
00119         
00120         INTERNAL_SERVER_ERROR = 500,
00121         NOT_IMPLEMENTED = 501,
00122         BAD_GATEWAY = 502,
00123         SERVICE_UNAVAILABLE = 503,
00124         GATEWAY_TIMEOUT = 504,
00125         HTTP_VERSION_NOT_SUPPORTED = 505,
00126         VARIANT_ALSO_NEGOTIATES = 506,
00127         INSUFFICIENT_STORAGE = 507,
00128         LOOP_DETECTED = 508,
00129         NOT_EXTENDED = 510,
00130         NETWORK_AUTHENTICATION_REQUIRED = 511,
00131         NETWORK_CONNECT_TIMEOUT_ERROR = 599
00132       };
00133 
00137       HTTPResponse();
00138 
00142       HTTPResponse(HTTPStatus statusCode);
00143 
00147       HTTPResponse(HTTPStatus statusCode, const std::string& reason);
00148 
00152       HTTPResponse(HTTPStatus statusCode, const std::string& reason, const std::string& body);
00153 
00157       HTTPResponse(HTTPStatus statusCode, const std::string& reason, const std::string& body, int versionMajor, int versionMinor, const HTTPHeaders& headers);
00158 
00162       HTTPResponse(const HTTPResponse& obj);
00163 
00167       HTTPResponse& operator=(const HTTPResponse& obj);
00168 
00172       ~HTTPResponse();
00173 
00177       HTTPStatus getStatusCode() const;
00178 
00182       const std::string& getReason() const;
00183 
00185 
00188       const std::string& getVersion() const;
00189 
00194       int getVersionMajor() const;
00195 
00200       int getVersionMinor() const;
00202 
00207       const std::string& getBody() const;
00208 
00212       int64_t getContentLength() const;
00213 
00217       const HTTPHeaders& getHeaders() const;
00218 
00222       static std::string getReasonPhrase(HTTPStatus status);
00223 
00224     private:
00227       std::shared_ptr<HTTPResponseImpl> getImpl() const;
00230     private:
00232       std::shared_ptr<HTTPResponseImpl> pImpl;
00233 
00234     };
00235 
00236   }
00237 }
00238