CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
CFxNANetworkRequest Class Reference

#include <FxNANetworkRequest.h>

Public Types

enum  KnownHeaders {
  ContentTypeHeader , ContentLengthHeader , LocationHeader , LastModifiedHeader ,
  CookieHeader , SetCookieHeader , ContentDispositionHeader , UserAgentHeader ,
  ServerHeader
}
 
enum  Attribute {
  HttpStatusCodeAttribute , HttpReasonPhraseAttribute , RedirectionTargetAttribute , ConnectionEncryptedAttribute ,
  CacheLoadControlAttribute , CacheSaveControlAttribute , SourceIsFromCacheAttribute , DoNotBufferUploadDataAttribute ,
  HttpPipeliningAllowedAttribute , HttpPipeliningWasUsedAttribute , CustomVerbAttribute , CookieLoadControlAttribute ,
  AuthenticationReuseAttribute , CookieSaveControlAttribute , MaximumDownloadBufferSizeAttribute , DownloadBufferAttribute ,
  SynchronousRequestAttribute , BackgroundRequestAttribute , SpdyAllowedAttribute , SpdyWasUsedAttribute ,
  EmitAllUploadProgressSignalsAttribute , FollowRedirectsAttribute , HTTP2AllowedAttribute , HTTP2WasUsedAttribute ,
  OriginalContentLengthAttribute , RedirectPolicyAttribute , User = 1000 , UserMax = 32767
}
 

Public Member Functions

 CFxNANetworkRequest (const CFxNAUrl &url=CFxNAUrl())
 
 CFxNANetworkRequest (const CFxNANetworkRequest &other)
 
CFxNANetworkRequestoperator= (const CFxNANetworkRequest &other)
 
 ~CFxNANetworkRequest ()
 
void setHandle (FxNetworkRequestHandle handle)
 
FxNetworkRequestHandle getHandle () const
 
void setHeader (CFxNANetworkRequest::KnownHeaders header, const CFxNAVariant &value)
 
CFxNAVariant header (CFxNANetworkRequest::KnownHeaders header) const
 
void setRawHeader (const CFxNAByteArray &headerName, const CFxNAByteArray &headerValue)
 
CFxNAVariant rawHeader (const CFxNAByteArray &headerName) const
 
CFxNAList< CFxNAByteArrayrawHeaderList () const
 
void setUrl (const CFxNAUrl &url)
 
CFxNAUrl url () const
 
void setRequestTimeout (int timeoutMs)
 
int requestTimeout () const
 

Detailed Description

Class CFxNANetworkRequest holds a request to be sent with CFxNANetworkAccessManager.

Definition at line 53 of file FxNANetworkRequest.h.

Member Enumeration Documentation

◆ Attribute

This enum type indicates Attribute codes for the CFxNANetworkRequest and CFxNANetworkReply.

Enumerator
HttpStatusCodeAttribute 

Replies only, type: CFxMetaType::Int (no default) Indicates the HTTP status code received from the HTTP server (like 200, 304, 404, 401, etc.). If the connection was not HTTP-based, this attribute will not be present.

HttpReasonPhraseAttribute 

Replies only, type: CFxMetaType::QByteArray (no default) Indicates the HTTP reason phrase as received from the HTTP server (like "Ok", "Found", "Not Found", "Access Denied", etc.) This is the human-readable representation of the status code (see above). If the connection was not HTTP-based, this attribute will not be present.

RedirectionTargetAttribute 

Replies only, type: CFxMetaType::CFxUrl (no default) If present, it indicates that the server is redirecting the request to a different URL.

ConnectionEncryptedAttribute 

Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained through an encrypted (secure) connection.

CacheLoadControlAttribute 

Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::PreferNetwork) Controls how the cache should be accessed..

CacheSaveControlAttribute 

Requests only, type: CFxMetaType::Bool (default: true) Controls if the data obtained should be saved to cache for future uses.

SourceIsFromCacheAttribute 

Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained from cache or not.

DoNotBufferUploadDataAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManager code is allowed to buffer the upload data, e.g. when doing a HTTP POST.

HttpPipeliningAllowedAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManager code is allowed to use HTTP pipelining with this request.

HttpPipeliningWasUsedAttribute 

Replies only, type: CFxMetaType::Bool Indicates whether the HTTP pipelining was used for receiving this reply.

CustomVerbAttribute 

Requests only, type: CFxMetaType::QByteArray Holds the value for the custom HTTP verb to send (destined for usage of other verbs than GET, POST, PUT and DELETE). This verb is set when calling.

CookieLoadControlAttribute 

Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to send 'Cookie' headers in the request. This attribute is set to false by CommonUI WebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request.

AuthenticationReuseAttribute 

Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to use cached authorization credentials in the request, if available.

CookieSaveControlAttribute 

Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to save 'Cookie' headers received from the server in reply to the request. This attribute is set to false by CommonUI WebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request.

MaximumDownloadBufferSizeAttribute 
DownloadBufferAttribute 
SynchronousRequestAttribute 
BackgroundRequestAttribute 

Type: CFxMetaType::Bool (default: false) Indicates that this is a background transfer, rather than a user initiated transfer. Depending on the platform, background transfers may be subject to different policies.

SpdyAllowedAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManager code is allowed to use SPDY with this request.

SpdyWasUsedAttribute 

Replies only, type: CFxMetaType::Bool Indicates whether SPDY was used for receiving this reply.

EmitAllUploadProgressSignalsAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether all upload signals should be emitted. By default, the uploadProgress signal is emitted only in 100 millisecond intervals.

FollowRedirectsAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the Network Access API should automatically follow a HTTP redirect response or not.

HTTP2AllowedAttribute 

Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManager code is allowed to use HTTP/2 with this request. This applies to SSL requests or 'cleartext' HTTP/2.

HTTP2WasUsedAttribute 

Replies only, type: CFxMetaType::Bool (default: false) Indicates whether HTTP/2 was used for receiving this reply.

OriginalContentLengthAttribute 

Replies only, type CFxMetaType::Int Holds the original content-length attribute before being invalidated and removed from the header when the data is compressed and the request was marked to be decompressed automatically.

RedirectPolicyAttribute 

Requests only, type: CFxMetaType::Int, should be one of the CFxNANetworkRequest::RedirectPolicy values (default: ManualRedirectPolicy).

User 

Special type. Additional information can be passed in QVariants with types ranging from User to UserMax. The default implementation of Network Access will ignore any request attributes in this range and it will not produce any attributes in this range in replies.

UserMax 

Special type. See User.

Definition at line 76 of file FxNANetworkRequest.h.

◆ KnownHeaders

This enum type indicates known header types that CFxNANetworkRequest parses. Each known header is also represented in raw form with its full HTTP name.

Enumerator
ContentTypeHeader 

Corresponds to the HTTP Content-Type header and contains a string containing the media (MIME) type and any auxiliary data (for instance, charset).

ContentLengthHeader 

Corresponds to the HTTP Content-Length header and contains the length in bytes of the data transmitted.

LocationHeader 

Corresponds to the HTTP Location header and contains a URL representing the actual location of the data, including the destination URL in case of redirections.

LastModifiedHeader 

Corresponds to the HTTP Last-Modified header and contains a CFxDateTime representing the last modification date of the contents.

CookieHeader 

Corresponds to the HTTP Cookie header and contains a CFxList CFxNetworkCookie representing the cookies to be sent back to the server.

SetCookieHeader 

Corresponds to the HTTP Set-Cookie header and contains a CFxList CFxNetworkCookie representing the cookies sent by the server to be stored locally.

ContentDispositionHeader 

Corresponds to the HTTP Content-Disposition header and contains a string containing the disposition type (for instance, attachment) and a parameter (for instance, filename).

UserAgentHeader 

The User-Agent header sent by HTTP clients.

ServerHeader 

The Server header received by HTTP clients.

Definition at line 60 of file FxNANetworkRequest.h.

Constructor & Destructor Documentation

◆ CFxNANetworkRequest() [1/2]

CFxNANetworkRequest::CFxNANetworkRequest ( const CFxNAUrl url = CFxNAUrl())
explicit

Constructor

Parameters
urlInput

◆ CFxNANetworkRequest() [2/2]

CFxNANetworkRequest::CFxNANetworkRequest ( const CFxNANetworkRequest other)

Constructor

Parameters
otherInput

◆ ~CFxNANetworkRequest()

CFxNANetworkRequest::~CFxNANetworkRequest ( )

Destructor

Member Function Documentation

◆ getHandle()

FxNetworkRequestHandle CFxNANetworkRequest::getHandle ( ) const

◆ header()

CFxNAVariant CFxNANetworkRequest::header ( CFxNANetworkRequest::KnownHeaders  header) const

Returns the value of the known header header, if that header was sent by the remote server

Parameters
headerInput attribute define by KnownHeaders enum
Returns
NAVariant If the header was not sent, returns an invalid CFxNAVariant.

◆ operator=()

CFxNANetworkRequest & CFxNANetworkRequest::operator= ( const CFxNANetworkRequest other)

Constructor Operator overloaded

Parameters
otherInput

◆ rawHeader()

CFxNAVariant CFxNANetworkRequest::rawHeader ( const CFxNAByteArray headerName) const

Returns the raw contents of the header headerName as sent by the remote server.

Parameters
headerNameInput
Returns
byteArray

◆ rawHeaderList()

CFxNAList< CFxNAByteArray > CFxNANetworkRequest::rawHeaderList ( ) const

Returns a list of headers fields that were sent by the remote server, in the order that they were sent.

Duplicate headers are merged together and take place of the latter duplicate.

Returns
list This returns the list of CFxNAByteArray type.

◆ requestTimeout()

int CFxNANetworkRequest::requestTimeout ( ) const

Returns the request timeout in milliseconds.

Returns
int

◆ setHandle()

void CFxNANetworkRequest::setHandle ( FxNetworkRequestHandle  handle)

◆ setHeader()

void CFxNANetworkRequest::setHeader ( CFxNANetworkRequest::KnownHeaders  header,
const CFxNAVariant value 
)

Sets the value of the known header header to be value, overriding any previously set headers.

This operation also sets the equivalent raw HTTP header.

Parameters
headerInput.
valueInput.

◆ setRawHeader()

void CFxNANetworkRequest::setRawHeader ( const CFxNAByteArray headerName,
const CFxNAByteArray headerValue 
)

Sets the header headerName to be of value headerValue

If headerName corresponds to a known header (see CFxNANetworkRequest::KnownHeaders), the raw format will be parsed and the corresponding "cooked" header will be set as wel

Parameters
headerNameInput.
headerValueInput.

◆ setRequestTimeout()

void CFxNANetworkRequest::setRequestTimeout ( int  timeoutMs)

Set the request timeout in milliseconds. Request timeout of 0 means that default value of

30000 milliseconds should be used.

Parameters
timeoutMsInput.

◆ setUrl()

void CFxNANetworkRequest::setUrl ( const CFxNAUrl url)

Sets the URL this network request is referring to be url.

Parameters
urlInput.

◆ url()

CFxNAUrl CFxNANetworkRequest::url ( ) const

Returns the URL this network request is referring to.

Returns
NAUrl

The documentation for this class was generated from the following file: