QNetworkRequest Class ReferenceThe QNetworkRequest class holds a request to be sent with QNetworkAccessManager. More... #include <QNetworkRequest> This class was introduced in Qt 4.4. Public Types
Public Functions
Detailed DescriptionThe 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 Type Documentationenum QNetworkRequest::AttributeAttribute 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 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.)
See here for more information. (This value was introduced in 4.7.)
See here for more information. (This value was introduced in 4.7.) (This value was introduced in 4.7.) (This value was introduced in 4.7.)
This enum was introduced or modified in Qt 4.7. enum QNetworkRequest::CacheLoadControlControls the caching mechanism of QNetworkAccessManager.
enum QNetworkRequest::KnownHeadersList 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(). enum QNetworkRequest::LoadControlIndicates 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. enum QNetworkRequest::PriorityThis enum lists the possible network request priorities.
This enum was introduced or modified in Qt 4.7. Member Function DocumentationQNetworkRequest::QNetworkRequest ( const QUrl & url = QUrl() )Constructs a QNetworkRequest object with url as the URL to be requested. QNetworkRequest::QNetworkRequest ( const QNetworkRequest & other )Creates a copy of other. QNetworkRequest::~QNetworkRequest ()Disposes of the QNetworkRequest object. QVariant QNetworkRequest::attribute ( Attribute code, const QVariant & defaultValue = QVariant() ) constReturns 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. bool QNetworkRequest::hasRawHeader ( const QByteArray & headerName ) constReturns true if the raw header headerName is present in this network request. See also rawHeader() and setRawHeader(). QVariant QNetworkRequest::header ( KnownHeaders header ) constReturns 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(). QObject * QNetworkRequest::originatingObject () constReturns 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. See also setOriginatingObject(). Priority QNetworkRequest::priority () constReturn the priority of this request. This function was introduced in Qt 4.7. See also setPriority(). QByteArray QNetworkRequest::rawHeader ( const QByteArray & headerName ) constReturns 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(). QList<QByteArray> QNetworkRequest::rawHeaderList () constReturns 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(). void QNetworkRequest::setAttribute ( Attribute code, const QVariant & 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. void QNetworkRequest::setHeader ( KnownHeaders header, const QVariant & 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(). void QNetworkRequest::setOriginatingObject ( QObject * object )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. See also originatingObject(). void QNetworkRequest::setPriority ( Priority priority )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. See also priority(). void QNetworkRequest::setRawHeader ( const QByteArray & headerName, const QByteArray & headerValue )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(). void QNetworkRequest::setSslConfiguration ( const QSslConfiguration & config )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) 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. See also sslConfiguration() and QSslConfiguration::defaultConfiguration(). void QNetworkRequest::setUrl ( const QUrl & url )Sets the URL this network request is referring to to be url. See also url(). QSslConfiguration QNetworkRequest::sslConfiguration () constReturns this network request's SSL configuration. By default, no SSL settings are specified. See also setSslConfiguration(). QUrl QNetworkRequest::url () constReturns the URL this network request is referring to. See also setUrl(). bool QNetworkRequest::operator!= ( const QNetworkRequest & other ) constReturns false if this object is not the same as other. See also operator==(). QNetworkRequest & QNetworkRequest::operator= ( const QNetworkRequest & other )Creates a copy of other bool QNetworkRequest::operator== ( const QNetworkRequest & other ) constReturns 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!=(). X
|
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |