CFx SDK Documentation  2020SP3
FxNANetworkRequest.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2020 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include "../FxCommonFramework.h"
20 #include "../UI/FxUIObject.h"
21 
22 #include <QtCore/QByteArray>
23 #include <QtCore/QList>
24 #include <QtCore/QUrl>
25 #include <QtCore/QVariant>
26 
27 using CFxNAByteArray = QByteArray;
28 template< typename T >
29 using CFxNAList = QList< T >;
30 using CFxNAUrl = QUrl;
31 using CFxNAVariant = QVariant;
32 
33 class CFxNANetworkRequestImpl;
34 
35 #if defined( Q_OS_IOS )
36  typedef void* FxNetworkRequestHandle;
37 #elif defined( Q_OS_ANDROID )
38  // TODO implementation
39  typedef CFxJavaHandle* FxNetworkRequestHandle;
40 #else
41  #if defined(XENON)
42  // TODO implementation
43  typedef void* FxNetworkRequestHandle;
44  #else
45  #include <QtNetwork/QNetworkRequest>
46  typedef QNetworkRequest* FxNetworkRequestHandle;
47  #endif
48 #endif
49 
54 {
55 public:
56 
61  {
70  ServerHeader
71  };
72 
76  enum Attribute
77  {
104 
105  User = 1000,
106  UserMax = 32767
107  };
108 
114  explicit CFxNANetworkRequest( const CFxNAUrl& url = CFxNAUrl() );
115 
122 
129 
132 
135 
146 
155 
165  void setRawHeader( const CFxNAByteArray& headerName, const CFxNAByteArray& headerValue );
166 
174  CFxNAVariant rawHeader( const CFxNAByteArray& headerName ) const;
175 
184 
190  void setUrl( const CFxNAUrl& url );
191 
197  CFxNAUrl url() const;
198 
206  void setRequestTimeout( int timeoutMs );
207 
213  int requestTimeout() const;
214 
215 private:
216  CFxNANetworkRequestImpl *m_pImpl;
217  FxNetworkRequestHandle m_pHandle;
218 
219  //...
220 };
CFxNANetworkRequest::MaximumDownloadBufferSizeAttribute
@ MaximumDownloadBufferSizeAttribute
Definition: FxNANetworkRequest.h:92
CFxNANetworkRequest::getHandle
FxNetworkRequestHandle getHandle() const
CFxNANetworkRequest::FollowRedirectsAttribute
@ FollowRedirectsAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the Network Access API shou...
Definition: FxNANetworkRequest.h:99
CFxNANetworkRequest::HttpPipeliningWasUsedAttribute
@ HttpPipeliningWasUsedAttribute
Replies only, type: CFxMetaType::Bool Indicates whether the HTTP pipelining was used for receiving th...
Definition: FxNANetworkRequest.h:87
CFxNANetworkRequest::HttpPipeliningAllowedAttribute
@ HttpPipeliningAllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
Definition: FxNANetworkRequest.h:86
CFxNANetworkRequest::OriginalContentLengthAttribute
@ OriginalContentLengthAttribute
Replies only, type CFxMetaType::Int Holds the original content-length attribute before being invalida...
Definition: FxNANetworkRequest.h:102
CFxNANetworkRequest::EmitAllUploadProgressSignalsAttribute
@ EmitAllUploadProgressSignalsAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether all upload signals should b...
Definition: FxNANetworkRequest.h:98
CFxNANetworkRequest::CookieLoadControlAttribute
@ CookieLoadControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
Definition: FxNANetworkRequest.h:89
CFxNANetworkRequest::rawHeader
CFxNAVariant rawHeader(const CFxNAByteArray &headerName) const
CFxNANetworkRequest::Attribute
Attribute
Definition: FxNANetworkRequest.h:77
CFxNANetworkRequest::BackgroundRequestAttribute
@ BackgroundRequestAttribute
Type: CFxMetaType::Bool (default: false) Indicates that this is a background transfer,...
Definition: FxNANetworkRequest.h:95
CFxNANetworkRequest::setRawHeader
void setRawHeader(const CFxNAByteArray &headerName, const CFxNAByteArray &headerValue)
CFxNANetworkRequest::ContentDispositionHeader
@ ContentDispositionHeader
Corresponds to the HTTP Content-Disposition header and contains a string containing the disposition t...
Definition: FxNANetworkRequest.h:68
CFxNANetworkRequest::ConnectionEncryptedAttribute
@ ConnectionEncryptedAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained throug...
Definition: FxNANetworkRequest.h:81
CFxNANetworkRequest::~CFxNANetworkRequest
~CFxNANetworkRequest()
CFxNANetworkRequest::setHandle
void setHandle(FxNetworkRequestHandle handle)
CFxNANetworkRequest::CustomVerbAttribute
@ CustomVerbAttribute
Requests only, type: CFxMetaType::QByteArray Holds the value for the custom HTTP verb to send (destin...
Definition: FxNANetworkRequest.h:88
CFxNANetworkRequest::CacheLoadControlAttribute
@ CacheLoadControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::PreferNetwork) Controls how the ...
Definition: FxNANetworkRequest.h:82
FxNetworkRequestHandle
QNetworkRequest * FxNetworkRequestHandle
Definition: FxNANetworkRequest.h:33
CFxNANetworkRequest::LocationHeader
@ LocationHeader
Corresponds to the HTTP Location header and contains a URL representing the actual location of the da...
Definition: FxNANetworkRequest.h:64
CFxNANetworkRequest::LastModifiedHeader
@ LastModifiedHeader
Corresponds to the HTTP Last-Modified header and contains a CFxDateTime representing the last modific...
Definition: FxNANetworkRequest.h:65
CFxNANetworkRequest::rawHeaderList
CFxNAList< CFxNAByteArray > rawHeaderList() const
CFxNANetworkRequest::UserAgentHeader
@ UserAgentHeader
The User-Agent header sent by HTTP clients.
Definition: FxNANetworkRequest.h:69
CFxNANetworkRequest::HttpReasonPhraseAttribute
@ HttpReasonPhraseAttribute
Replies only, type: CFxMetaType::QByteArray (no default) Indicates the HTTP reason phrase as received...
Definition: FxNANetworkRequest.h:79
CFxNANetworkRequest::SpdyAllowedAttribute
@ SpdyAllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
Definition: FxNANetworkRequest.h:96
CFxNANetworkRequest
Definition: FxNANetworkRequest.h:54
CFxNANetworkRequest::CookieHeader
@ CookieHeader
Corresponds to the HTTP Cookie header and contains a CFxList CFxNetworkCookie representing the cookie...
Definition: FxNANetworkRequest.h:66
CFxNANetworkRequest::setRequestTimeout
void setRequestTimeout(int timeoutMs)
CFxNANetworkRequest::HTTP2WasUsedAttribute
@ HTTP2WasUsedAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether HTTP/2 was used for receivin...
Definition: FxNANetworkRequest.h:101
CFxNANetworkRequest::AuthenticationReuseAttribute
@ AuthenticationReuseAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
Definition: FxNANetworkRequest.h:90
CFxNANetworkRequest::SourceIsFromCacheAttribute
@ SourceIsFromCacheAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained from c...
Definition: FxNANetworkRequest.h:84
CFxNANetworkRequest::RedirectPolicyAttribute
@ RedirectPolicyAttribute
Requests only, type: CFxMetaType::Int, should be one of the CFxNANetworkRequest::RedirectPolicy value...
Definition: FxNANetworkRequest.h:103
CFxNAByteArray
QByteArray CFxNAByteArray
Definition: FxNANetworkAccessManager.h:32
CFxNAUrl
QUrl CFxNAUrl
Definition: FxNANetworkRequest.h:30
CFxNANetworkRequest::requestTimeout
int requestTimeout() const
CFxNANetworkRequest::CFxNANetworkRequest
CFxNANetworkRequest(const CFxNAUrl &url=CFxNAUrl())
CFxNANetworkRequest::operator=
CFxNANetworkRequest & operator=(const CFxNANetworkRequest &other)
CFxNANetworkRequest::ContentLengthHeader
@ ContentLengthHeader
Corresponds to the HTTP Content-Length header and contains the length in bytes of the data transmitte...
Definition: FxNANetworkRequest.h:63
CFxNANetworkRequest::setUrl
void setUrl(const CFxNAUrl &url)
CFxNANetworkRequest::CFxNANetworkRequest
CFxNANetworkRequest(const CFxNANetworkRequest &other)
CFxNANetworkRequest::DoNotBufferUploadDataAttribute
@ DoNotBufferUploadDataAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
Definition: FxNANetworkRequest.h:85
CFxNANetworkRequest::KnownHeaders
KnownHeaders
Definition: FxNANetworkRequest.h:61
CFxNANetworkRequest::SpdyWasUsedAttribute
@ SpdyWasUsedAttribute
Replies only, type: CFxMetaType::Bool Indicates whether SPDY was used for receiving this reply.
Definition: FxNANetworkRequest.h:97
CFxNAList
QList< T > CFxNAList
Definition: FxNANetworkReply.h:35
CFxNANetworkRequest::CookieSaveControlAttribute
@ CookieSaveControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
Definition: FxNANetworkRequest.h:91
COMMONUI_API
#define COMMONUI_API
Definition: FxCommonFramework.h:4
CFxNANetworkRequest::setHeader
void setHeader(CFxNANetworkRequest::KnownHeaders header, const CFxNAVariant &value)
CFxNANetworkRequest::SynchronousRequestAttribute
@ SynchronousRequestAttribute
Definition: FxNANetworkRequest.h:94
CFxNANetworkRequest::SetCookieHeader
@ SetCookieHeader
Corresponds to the HTTP Set-Cookie header and contains a CFxList CFxNetworkCookie representing the co...
Definition: FxNANetworkRequest.h:67
value
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
CFxNAVariant
QVariant CFxNAVariant
Definition: FxNANetworkReply.h:39
CFxNANetworkRequest::CacheSaveControlAttribute
@ CacheSaveControlAttribute
Requests only, type: CFxMetaType::Bool (default: true) Controls if the data obtained should be saved ...
Definition: FxNANetworkRequest.h:83
CFxNANetworkRequest::HttpStatusCodeAttribute
@ HttpStatusCodeAttribute
Replies only, type: CFxMetaType::Int (no default) Indicates the HTTP status code received from the HT...
Definition: FxNANetworkRequest.h:78
CFxNANetworkRequest::header
CFxNAVariant header(CFxNANetworkRequest::KnownHeaders header) const
CFxNANetworkRequest::ContentTypeHeader
@ ContentTypeHeader
Corresponds to the HTTP Content-Type header and contains a string containing the media (MIME) type an...
Definition: FxNANetworkRequest.h:62
CFxNANetworkRequest::RedirectionTargetAttribute
@ RedirectionTargetAttribute
Replies only, type: CFxMetaType::CFxUrl (no default) If present, it indicates that the server is redi...
Definition: FxNANetworkRequest.h:80
CFxNANetworkRequest::HTTP2AllowedAttribute
@ HTTP2AllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
Definition: FxNANetworkRequest.h:100
CFxNANetworkRequest::url
CFxNAUrl url() const
CFxNANetworkRequest::DownloadBufferAttribute
@ DownloadBufferAttribute
Definition: FxNANetworkRequest.h:93