Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtNetwork.QNetworkRequest Class Reference

The QNetworkRequest class holds a request to be sent with QNetworkAccessManager. More...

Inheritance diagram for QtNetwork.QNetworkRequest:
Collaboration diagram for QtNetwork.QNetworkRequest:

Public Types

enum  Attribute {
  AuthenticationReuseAttribute = 12, CacheLoadControlAttribute = 4, CacheSaveControlAttribute = 5, ConnectionEncryptedAttribute = 3,
  CookieLoadControlAttribute = 11, CookieSaveControlAttribute = 13, CustomVerbAttribute = 10, DoNotBufferUploadDataAttribute = 7,
  DownloadBufferAttribute = 15, HttpPipeliningAllowedAttribute = 8, HttpPipeliningWasUsedAttribute = 9, HttpReasonPhraseAttribute = 1,
  HttpStatusCodeAttribute = 0, MaximumDownloadBufferSizeAttribute = 14, RedirectionTargetAttribute = 2, SourceIsFromCacheAttribute = 6,
  SynchronousRequestAttribute = 16, User = 1000, UserMax = 32767
}
  More...
 
enum  CacheLoadControl { AlwaysCache = 3, AlwaysNetwork = 0, PreferCache = 2, PreferNetwork = 1 }
  More...
 
enum  KnownHeaders {
  ContentDispositionHeader = 6, ContentLengthHeader = 1, ContentTypeHeader = 0, CookieHeader = 4,
  LastModifiedHeader = 3, LocationHeader = 2, SetCookieHeader = 5
}
  More...
 
enum  LoadControl { Automatic = 0, Manual = 1 }
  More...
 
enum  Priority { HighPriority = 1, LowPriority = 5, NormalPriority = 3 }
  More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QNetworkRequest ()
 
 
 QNetworkRequest (QUrl url)
 
 
 QNetworkRequest (QNetworkRequest other)
 
 
virtual void CreateProxy ()
 
new object attribute (QNetworkRequest.Attribute code)
 
 
new object attribute (QNetworkRequest.Attribute code, object defaultValue)
 
 
new bool HasRawHeader (QByteArray headerName)
 
 
new object Header (QNetworkRequest.KnownHeaders header)
 
 
new QByteArray RawHeader (QByteArray headerName)
 
 
new
System.Collections.Generic.List
< QByteArray
RawHeaderList ()
 
 
new void SetAttribute (QNetworkRequest.Attribute code, object value)
 
 
new void SetHeader (QNetworkRequest.KnownHeaders header, object value)
 
 
new void SetRawHeader (QByteArray headerName, QByteArray value)
 
 
new void Dispose ()
 

Static Public Member Functions

static bool operator!= (QNetworkRequest arg1, QNetworkRequest arg2)
 
 
static bool operator== (QNetworkRequest arg1, QNetworkRequest arg2)
 
 

Protected Member Functions

 QNetworkRequest (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new QObject OriginatingObject [get, set]
 
 
new QNetworkRequest.Priority priority [get, set]
 
 
new QSslConfiguration SslConfiguration [get, set]
 
 
new QUrl Url [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.

QNetworkRequest is part of the Network Access API and is the class holding the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request.

See also QNetworkReply and QNetworkAccessManager.

Member Enumeration Documentation

Attribute codes for the QNetworkRequest and QNetworkReply.

Attributes are extra meta-data that are used to control the behavior of the request and to pass further information from the reply back to the application. Attributes are also extensible, allowing custom implementations to pass custom values.

The following table explains what the default attribute codes are, the QVariant types associated, the default value if said attribute is missing and whether it's used in requests or replies.

This enum was introduced or modified in Qt 4.7.

Enumerator:
AuthenticationReuseAttribute 

Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to use cached authorization credentials in the request, if available. If this is set to QNetworkRequest::Manual and the authentication mechanism is 'Basic' or 'Digest', Qt will not send an an 'Authorization' HTTP header with any cached credentials it may have for the request's URL. This attribute is set to QNetworkRequest::Manual by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)

CacheLoadControlAttribute 

Requests only, type: QVariant::Int (default: QNetworkRequest::PreferNetwork) Controls how the cache should be accessed. The possible values are those of QNetworkRequest::CacheLoadControl. Note that the default QNetworkAccessManager implementation does not support caching. However, this attribute may be used by certain backends to modify their requests (for example, for caching proxies).

CacheSaveControlAttribute 

Requests only, type: QVariant::Bool (default: true) Controls if the data obtained should be saved to cache for future uses. If the value is false, the data obtained will not be automatically cached. If true, data may be cached, provided it is cacheable (what is cacheable depends on the protocol being used).

ConnectionEncryptedAttribute 

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

CookieLoadControlAttribute 

Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to send 'Cookie' headers in the request. This attribute is set to false by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)

CookieSaveControlAttribute 

Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to save 'Cookie' headers received from the server in reply to the request. This attribute is set to false by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)

CustomVerbAttribute 

Requests only, type: QVariant::ByteArray 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 QNetworkAccessManager::sendCustomRequest().

DoNotBufferUploadDataAttribute 

Requests only, type: QVariant::Bool (default: false) Indicates whether the QNetworkAccessManager code is allowed to buffer the upload data, e.g. when doing a HTTP POST. When using this flag with sequential upload data, the ContentLengthHeader header must be set.

DownloadBufferAttribute 
HttpPipeliningAllowedAttribute 

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

HttpPipeliningWasUsedAttribute 

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

HttpReasonPhraseAttribute 

Replies only, type: QVariant::ByteArray (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.

HttpStatusCodeAttribute 

Replies only, type: QVariant::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.

MaximumDownloadBufferSizeAttribute 
RedirectionTargetAttribute 

Replies only, type: QVariant::Url (no default) If present, it indicates that the server is redirecting the request to a different URL. The Network Access API does not by default follow redirections: it's up to the application to determine if the requested redirection should be allowed, according to its security policies. The returned URL might be relative. Use QUrl::resolved() to create an absolute URL out of it.

SourceIsFromCacheAttribute 

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

SynchronousRequestAttribute 
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. The range is reserved for extensions of QNetworkAccessManager.

UserMax 

Special type. See User.

Controls the caching mechanism of QNetworkAccessManager.

Enumerator:
AlwaysCache 

Only load from cache, indicating error if the item was not cached (i.e., off-line mode)

AlwaysNetwork 

Always load from network and do not check if the cache has a valid entry (similar to the "Reload" feature in browsers)

PreferCache 

Load from cache if available, otherwise load from network. Note that this can return possibly stale (but not expired) items from cache.

PreferNetwork 

Default value; load from the network if the cached entry is older than the network entry

List of known header types that QNetworkRequest parses. Each known header is also represented in raw form with its full HTTP name.

See also header(), setHeader(), rawHeader(), and setRawHeader().

Enumerator:
ContentDispositionHeader 
ContentLengthHeader 

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

ContentTypeHeader 

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

CookieHeader 

Corresponds to the HTTP Cookie header and contains a QList<QNetworkCookie> representing the cookies to be sent back to the server

LastModifiedHeader 

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

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.

SetCookieHeader 

Corresponds to the HTTP Set-Cookie header and contains a QList<QNetworkCookie> representing the cookies sent by the server to be stored locally

Indicates if an aspect of the request's loading mechanism has been manually overridden, e.g. by QtWebKit.

This enum was introduced or modified in Qt 4.7.

Enumerator:
Automatic 

Default value: indicates default behaviour.

Manual 

Indicates behaviour has been manually overridden.

This enum lists the possible network request priorities.

This enum was introduced or modified in Qt 4.7.

Enumerator:
HighPriority 

High priority

LowPriority 

Low priority

NormalPriority 

Normal priority

Constructor & Destructor Documentation

QtNetwork.QNetworkRequest.QNetworkRequest ( System.Type  dummy)
protected
QtNetwork.QNetworkRequest.QNetworkRequest ( )

Constructs a QNetworkRequest object with url as the URL to be requested.

See also url() and setUrl().

QtNetwork.QNetworkRequest.QNetworkRequest ( QUrl  url)

Constructs a QNetworkRequest object with url as the URL to be requested.

See also url() and setUrl().

QtNetwork.QNetworkRequest.QNetworkRequest ( QNetworkRequest  other)

Creates a copy of other.

Member Function Documentation

new object QtNetwork.QNetworkRequest.attribute ( QNetworkRequest.Attribute  code)

Returns the attribute associated with the code code. If the attribute has not been set, it returns defaultValue.

Note: this function does not apply the defaults listed in QNetworkRequest::Attribute.

See also setAttribute() and QNetworkRequest::Attribute.

new object QtNetwork.QNetworkRequest.attribute ( QNetworkRequest.Attribute  code,
object  defaultValue 
)

Returns the attribute associated with the code code. If the attribute has not been set, it returns defaultValue.

Note: this function does not apply the defaults listed in QNetworkRequest::Attribute.

See also setAttribute() and QNetworkRequest::Attribute.

virtual void QtNetwork.QNetworkRequest.CreateProxy ( )
virtual
new void QtNetwork.QNetworkRequest.Dispose ( )
override bool QtNetwork.QNetworkRequest.Equals ( object  o)
override int QtNetwork.QNetworkRequest.GetHashCode ( )
new bool QtNetwork.QNetworkRequest.HasRawHeader ( QByteArray  headerName)

Returns true if the raw header headerName is present in this network request.

See also rawHeader() and setRawHeader().

new object QtNetwork.QNetworkRequest.Header ( QNetworkRequest.KnownHeaders  header)

Returns the value of the known network header header if it is present in this request. If it is not present, returns QVariant() (i.e., an invalid variant).

See also KnownHeaders, rawHeader(), and setHeader().

static bool QtNetwork.QNetworkRequest.operator!= ( QNetworkRequest  arg1,
QNetworkRequest  arg2 
)
static

Returns false if this object is not the same as other.

See also operator==().

static bool QtNetwork.QNetworkRequest.operator== ( QNetworkRequest  arg1,
QNetworkRequest  arg2 
)
static

Returns true if this object is the same as other (i.e., if they have the same URL, same headers and same meta-data settings).

See also operator!=().

new QByteArray QtNetwork.QNetworkRequest.RawHeader ( QByteArray  headerName)

Returns the raw form of header headerName. If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasRawHeader() to find out if the header exists or not).

Raw headers can be set with setRawHeader() or with setHeader().

See also header() and setRawHeader().

new System.Collections.Generic.List<QByteArray> QtNetwork.QNetworkRequest.RawHeaderList ( )

Returns a list of all raw headers that are set in this network request. The list is in the order that the headers were set.

See also hasRawHeader() and rawHeader().

new void QtNetwork.QNetworkRequest.SetAttribute ( QNetworkRequest.Attribute  code,
object  value 
)

Sets the attribute associated with code code to be value value. If the attribute is already set, the previous value is discarded. In special, if value is an invalid QVariant, the attribute is unset.

See also attribute() and QNetworkRequest::Attribute.

new void QtNetwork.QNetworkRequest.SetHeader ( QNetworkRequest.KnownHeaders  header,
object  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.

See also KnownHeaders, setRawHeader(), and header().

new void QtNetwork.QNetworkRequest.SetRawHeader ( QByteArray  headerName,
QByteArray  value 
)

Sets the header headerName to be of value headerValue. If headerName corresponds to a known header (see QNetworkRequest::KnownHeaders), the raw format will be parsed and the corresponding "cooked" header will be set as well.

For example:

request.setRawHeader("Last-Modified", "Sun, 06 Nov 1994 08:49:37 GMT");

will also set the known header LastModifiedHeader to be the QDateTime object of the parsed date.

Note: setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header.

See also KnownHeaders, setHeader(), hasRawHeader(), and rawHeader().

Member Data Documentation

SmokeInvocation QtNetwork.QNetworkRequest.interceptor
protected

Property Documentation

new QObject QtNetwork.QNetworkRequest.OriginatingObject
getset

Returns a reference to the object that initiated this network request; returns 0 if not set or the object has been destroyed.

This function was introduced in Qt 4.6.

Allows setting a reference to the object initiating the request.

For example QtWebKit sets the originating object to the QWebFrame that initiated the request.

This function was introduced in Qt 4.6.

new QNetworkRequest.Priority QtNetwork.QNetworkRequest.priority
getset

Return the priority of this request.

This function was introduced in Qt 4.7.

Set the priority of this request to priority.

Note: The priority is only a hint to the network access manager. It can use it or not. Currently it is used for HTTP to decide which request should be sent first to a server.

This function was introduced in Qt 4.7.

virtual System.IntPtr QtNetwork.QNetworkRequest.SmokeObject
getset
new QSslConfiguration QtNetwork.QNetworkRequest.SslConfiguration
getset

Returns this network request's SSL configuration. By default, no SSL settings are specified.

Sets this network request's SSL configuration to be config. The settings that apply are the private key, the local certificate, the SSL protocol (SSLv2, SSLv3, TLSv1 where applicable), the CA certificates and the ciphers that the SSL backend is allowed to use.

By default, no SSL configuration is set, which allows the backends to choose freely what configuration is best for them.

new QUrl QtNetwork.QNetworkRequest.Url
getset

Returns the URL this network request is referring to.

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