Qyoto
4.0.5
Qyoto is a C# language binding for Qt
|
The QNetworkAccessManager class allows the application to send network requests and receive replies More...
Public Types | |
enum | NetworkAccessibility { Accessible = 1, NotAccessible = 0, UnknownAccessibility = -1 } |
More... | |
enum | Operation { CustomOperation = 6, DeleteOperation = 5, GetOperation = 2, HeadOperation = 1, PostOperation = 4, PutOperation = 3, UnknownOperation = 0 } |
More... | |
Public Member Functions | |
QNetworkAccessManager (QObject parent=null) | |
| |
override void | CreateProxy () |
new QNetworkConfiguration | ActiveConfiguration () |
| |
new QNetworkReply | DeleteResource (QNetworkRequest request) |
| |
new QNetworkReply | Get (QNetworkRequest request) |
| |
new QNetworkReply | Head (QNetworkRequest request) |
| |
new QNetworkReply | Post (QNetworkRequest request, QIODevice data) |
| |
new QNetworkReply | Post (QNetworkRequest request, QByteArray data) |
| |
new QNetworkReply | Post (QNetworkRequest request, QHttpMultiPart multiPart) |
| |
new QNetworkReply | Put (QNetworkRequest request, QIODevice data) |
| |
new QNetworkReply | Put (QNetworkRequest request, QByteArray data) |
| |
new QNetworkReply | Put (QNetworkRequest request, QHttpMultiPart multiPart) |
| |
new QNetworkReply | SendCustomRequest (QNetworkRequest request, QByteArray verb, QIODevice data=null) |
| |
new void | Dispose () |
Public Member Functions inherited from QtCore.QObject | |
QObject (QObject parent=null) | |
| |
new bool | BlockSignals (bool b) |
| |
new System.Collections.Generic.List < QObject > | Children () |
| |
new bool | Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection) |
| |
new void | DeleteLater () |
| |
new bool | Disconnect (QObject receiver, string member=null) |
| |
new bool | Disconnect (string signal=null, QObject receiver=null, string member=null) |
| |
new void | DumpObjectInfo () |
| |
new void | DumpObjectTree () |
| |
new System.Collections.Generic.List < QByteArray > | DynamicPropertyNames () |
| |
virtual bool | OnEvent (QEvent arg1) |
| |
virtual bool | EventFilter (QObject arg1, QEvent arg2) |
| |
new bool | Inherits (string classname) |
| |
new void | InstallEventFilter (QObject arg1) |
| |
new bool | IsWidgetType () |
| |
new void | KillTimer (int id) |
| |
new object | Property (string name) |
| |
new void | RemoveEventFilter (QObject arg1) |
| |
new bool | SetProperty (string name, object value) |
| |
new void | SetUserData (uint id, QObjectUserData data) |
new bool | SignalsBlocked () |
| |
new int | StartTimer (int interval) |
| |
new QObjectUserData | UserData (uint id) |
new void | Dispose () |
Public Member Functions inherited from QtCore.Qt | |
delegate QTextStream | FuncQTextStreamQTextStream (QTextStream qTextStream) |
delegate string | FuncStringQByteArray (QByteArray qByteArray) |
delegate QByteArray | FuncQByteArrayString (string @string) |
delegate void | ActionQtMsgTypeString (QtMsgType qtMsgType, string @string) |
delegate QObject | FuncQObject () |
Static Public Member Functions | |
static string | Tr (string s, string c=null) |
static string | Tr (string s, string c, int n) |
static string | TrUtf8 (string s, string c=null) |
static string | TrUtf8 (string s, string c, int n) |
Static Public Member Functions inherited from QtCore.QObject | |
static bool | Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection) |
| |
static bool | Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection) |
| |
static bool | Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member) |
| |
static bool | Disconnect (QObject sender, string signal, QObject receiver, string member) |
| |
static uint | RegisterUserData () |
static string | Tr (string s, string c=null) |
| |
static string | Tr (string s, string c, int n) |
| |
static string | TrUtf8 (string s, string c=null) |
| |
static string | TrUtf8 (string s, string c, int n) |
| |
Static Public Member Functions inherited from QtCore.Qt | |
static QDataStream | Write (QDataStream s, object p) |
static QDataStream | Write (QDataStream arg1, QSizeF arg2) |
static QTextStream | Write (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Write (QDataStream arg1, QPoint arg2) |
static QDataStream | Write (QDataStream arg1, QLineF arg2) |
static QDataStream | Write (QDataStream arg1, QPointF arg2) |
static QDataStream | Write (QDataStream arg1, QChar arg2) |
static QDataStream | Write (QDataStream arg1, QByteArray arg2) |
static QDataStream | Write (QDataStream arg1, QEasingCurve arg2) |
static QDataStream | Write (QDataStream arg1, QRectF arg2) |
static QDataStream | Write (QDataStream arg1, QDateTime arg2) |
static QDataStream | Write (QDataStream arg1, QUrl arg2) |
static QDataStream | Write (QDataStream arg1, QTime arg2) |
static QDataStream | Write (QDataStream arg1, QLocale arg2) |
static QDataStream | Write (QDataStream arg1, QBitArray arg2) |
static QDataStream | Write (QDataStream arg1, QUuid arg2) |
static QDataStream | Write (QDataStream arg1, QLine arg2) |
static QDataStream | Write (QDataStream arg1, QDate arg2) |
static QDataStream | Write (QDataStream @out, QRegExp regExp) |
static QDataStream | Write (QDataStream arg1, QRect arg2) |
static QDataStream | Write (QDataStream arg1, QSize arg2) |
static QDataStream | Write (QDataStream s, QVariant.Type p) |
static QDataStream | Write (QDataStream arg1, string arg2) |
static QDataStream | Write (QDataStream @out, System.Collections.Generic.List< string > list) |
static QDataStream | Read (QDataStream arg1, QChar arg2) |
static QDataStream | Read (QDataStream arg1, QLocale arg2) |
static QDataStream | Read (QDataStream arg1, QRect arg2) |
static QDataStream | Read (QDataStream arg1, QEasingCurve arg2) |
static QDataStream | Read (QDataStream arg1, QDate arg2) |
static QDataStream | Read (QDataStream arg1, QUrl arg2) |
static QDataStream | Read (QDataStream arg1, QUuid arg2) |
static QTextStream | Read (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Read (QDataStream arg1, QLineF arg2) |
static QDataStream | Read (QDataStream arg1, QRectF arg2) |
static QDataStream | Read (QDataStream arg1, QPointF arg2) |
static QDataStream | Read (QDataStream arg1, QLine arg2) |
static QDataStream | Read (QDataStream arg1, QBitArray arg2) |
static QDataStream | Read (QDataStream arg1, QSize arg2) |
static QDataStream | Read (QDataStream arg1, QDateTime arg2) |
static QDataStream | Read (QDataStream arg1, QTime arg2) |
static QDataStream | Read (QDataStream arg1, QPoint arg2) |
static QDataStream | Read (QDataStream @in, QRegExp regExp) |
static QDataStream | Read (QDataStream s, object p) |
static QDataStream | Read (QDataStream arg1, QByteArray arg2) |
static QDataStream | Read (QDataStream arg1, QSizeF arg2) |
static QDataStream | Read (QDataStream arg1, string arg2) |
static QDataStream | Read (QDataStream s, QVariant.Type p) |
static QDataStream | Read (QDataStream @in, System.Collections.Generic.List< string > list) |
static double | qAcos (double v) |
static void | qAddPostRoutine (System.Action arg1) |
static string | qAppName () |
static double | qAsin (double v) |
static double | qAtan (double v) |
static double | qAtan2 (double x, double y) |
static void | qBadAlloc () |
static int | qCeil (double v) |
static ushort | qChecksum (string s, uint len) |
static QByteArray | qCompress (QByteArray data) |
static QByteArray | qCompress (QByteArray data, int compressionLevel=-1) |
static QByteArray | qCompress (Pointer< byte > data, int nbytes) |
static QByteArray | qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1) |
static double | qCos (double v) |
static double | qExp (double v) |
static double | qFabs (double v) |
static double | qFastCos (double x) |
static double | qFastSin (double x) |
static string | qFlagLocation (string method) |
static int | qFloor (double v) |
static bool | qFuzzyCompare (double p1, double p2) |
static bool | qFuzzyCompare (float p1, float p2) |
static bool | qFuzzyIsNull (double d) |
static bool | qFuzzyIsNull (float f) |
static uint | qHash (QBitArray key) |
static uint | qHash (QChar key) |
static uint | qHash (QStringRef key) |
static uint | qHash (QUrl url) |
static uint | qHash (QPersistentModelIndex index) |
static uint | qHash (QByteArray key) |
static uint | qHash (QModelIndex index) |
static uint | qHash (uint key) |
static uint | qHash (sbyte key) |
static uint | qHash (byte key) |
static uint | qHash (short key) |
static uint | qHash (NativeLong key) |
static uint | qHash (ushort key) |
static uint | qHash (long key) |
static uint | qHash (ulong key) |
static uint | qHash (int key) |
static uint | qHash (string key) |
static uint | qHash (NativeULong key) |
static double | qInf () |
static Qt.ActionQtMsgTypeString | qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1) |
static int | qIntCast (float f) |
static int | qIntCast (double f) |
static bool | qIsFinite (double d) |
static bool | qIsFinite (float f) |
static bool | qIsInf (float f) |
static bool | qIsInf (double d) |
static bool | qIsNaN (float f) |
static bool | qIsNaN (double d) |
static bool | qIsNull (float f) |
static bool | qIsNull (double d) |
static double | qLn (double v) |
static double | qPow (double x, double y) |
static double | qQNaN () |
static void | qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function) |
static void | qRemovePostRoutine (System.Action arg1) |
static int | qRound (double d) |
static long | qRound64 (double d) |
static double | qSNaN () |
static bool | qSharedBuild () |
static double | qSin (double v) |
static double | qSqrt (double v) |
static bool | qStringComparisonHelper (QStringRef s1, string s2) |
static double | qTan (double v) |
static QByteArray | qUncompress (QByteArray data) |
static QByteArray | qUncompress (Pointer< byte > data, int nbytes) |
static string | qVersion () |
static void | Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size) |
static QByteArray | Qgetenv (string varName) |
static bool | Qputenv (string varName, QByteArray value) |
static int | Qrand () |
static void | Qsrand (uint seed) |
static int | Qstrcmp (QByteArray str1, QByteArray str2) |
static int | Qstrcmp (QByteArray str1, string str2) |
static int | Qstrcmp (string str1, QByteArray str2) |
static int | Qstrcmp (string str1, string str2) |
static Pointer< sbyte > | Qstrcpy (Pointer< sbyte > dst, string src) |
static Pointer< sbyte > | Qstrdup (string arg1) |
static int | Qstricmp (string arg1, string arg2) |
static uint | Qstrlen (string str) |
static int | Qstrncmp (string str1, string str2, uint len) |
static Pointer< sbyte > | Qstrncpy (Pointer< sbyte > dst, string src, uint len) |
static int | Qstrnicmp (string arg1, string arg2, uint len) |
static uint | Qstrnlen (string str, uint maxlen) |
static string | QtTrId (string id, int n=-1) |
Protected Member Functions | |
QNetworkAccessManager (System.Type dummy) | |
new void | OnAuthenticationRequired (QNetworkReply reply, QAuthenticator authenticator) |
| |
virtual QNetworkReply | CreateRequest (QNetworkAccessManager.Operation op, QNetworkRequest request, QIODevice outgoingData=null) |
| |
new void | OnFinished (QNetworkReply reply) |
| |
new void | OnNetworkAccessibleChanged (QNetworkAccessManager.NetworkAccessibility accessible) |
| |
new void | OnNetworkSessionConnected () |
new void | OnProxyAuthenticationRequired (QNetworkProxy proxy, QAuthenticator authenticator) |
| |
new void | OnSslErrors (QNetworkReply reply, System.Collections.Generic.List< QSslError > errors) |
| |
Protected Member Functions inherited from QtCore.QObject | |
QObject (System.Type dummy) | |
virtual void | OnChildEvent (QChildEvent arg1) |
| |
virtual void | ConnectNotify (string signal) |
| |
virtual void | OnCustomEvent (QEvent arg1) |
| |
new void | OnDestroyed (QObject arg1=null) |
| |
virtual void | DisconnectNotify (string signal) |
| |
new int | Receivers (string signal) |
| |
new QObject | Sender () |
| |
new int | SenderSignalIndex () |
| |
virtual void | OnTimerEvent (QTimerEvent arg1) |
| |
Additional Inherited Members | |
Protected Attributes inherited from QtCore.QObject | |
object | Q_EMIT = null |
SmokeInvocation | interceptor |
readonly List< QEventHandler > | eventFilters = new List<QEventHandler>() |
The QNetworkAccessManager class allows the application to send network requests and receive replies
The Network Access API is constructed around one QNetworkAccessManager object, which holds the common configuration and settings for the requests it sends. It contains the proxy and cache configuration, as well as the signals related to such issues, and reply signals that can be used to monitor the progress of a network operation. One QNetworkAccessManager should be enough for the whole Qt application.
Once a QNetworkAccessManager object has been created, the application can use it to send requests over the network. A group of standard functions are supplied that take a request and optional data, and each return a QNetworkReply object. The returned object is used to obtain any data returned in response to the corresponding request.
A simple download off the network could be accomplished with:
QNetworkAccessManager manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply)),
this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
QNetworkAccessManager has an asynchronous API. When the replyFinished slot above is called, the parameter it takes is the QNetworkReply object containing the downloaded data as well as meta-data (headers, etc.).
Note: After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function.
Note: QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol. Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination.
A more involved example, assuming the manager is already existent, can be:
QNetworkRequest request;
request.setUrl(QUrl("http://qt.nokia.com"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));
Network and Roaming support
With the addition of the Bearer Management API to Qt 4.7 QNetworkAccessManager gained the ability to manage network connections. QNetworkAccessManager can start the network interface if the device is offline and terminates the interface if the current process is the last one to use the uplink. Note that some platform utilize grace periods from when the last application stops using a uplink until the system actually terminates the connectivity link. Roaming is equally transparent. Any queued/pending network requests are automatically transferred to new access point.
Clients wanting to utilize this feature should not require any changes. In fact it is likely that existing platform specific connection code can simply be removed from the application.
Note: The network and roaming support in QNetworkAccessManager is conditional upon the platform supporting connection management. The QNetworkConfigurationManager::NetworkSessionRequired can be used to detect whether QNetworkAccessManager utilizes this feature. Currently only Meego/Harmattan and Symbian platforms provide connection management support.
Note: This feature cannot be used in combination with the Bearer Management API as provided by QtMobility. Applications have to migrate to the Qt version of Bearer Management.
Symbian Platform Security Requirements
On Symbian, processes which use this class must have the NetworkServices platform security capability. If the client process lacks this capability, operations will result in a panic.
Platform security capabilities are added via the TARGET.CAPABILITY qmake variable.
See also QNetworkRequest, QNetworkReply, and QNetworkProxy.
Indicates whether the network is accessible via this network access manager.
See also networkAccessible.
Indicates the operation this reply is processing.
This enum was introduced or modified in Qt 4.7.
See also QNetworkReply::operation().
|
protected |
QtNetwork.QNetworkAccessManager.QNetworkAccessManager | ( | QObject | parent = null | ) |
Constructs a QNetworkAccessManager object that is the center of the Network Access API and sets parent as the parent object.
new QNetworkConfiguration QtNetwork.QNetworkAccessManager.ActiveConfiguration | ( | ) |
Returns the current active network configuration.
If the network configuration returned by configuration() is of type QNetworkConfiguration::ServiceNetwork this function will return the current active child network configuration of that configuration. Otherwise returns the same network configuration as configuration().
Use this function to return the actual network configuration currently in use by the network session.
This function was introduced in Qt 4.7.
See also configuration().
|
virtual |
Reimplemented from QtCore.QObject.
|
protectedvirtual |
Returns a new QNetworkReply object to handle the operation op and request req. The device outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in those operations (the QByteArray variants will pass a QBuffer object).
The default implementation calls QNetworkCookieJar::cookiesForUrl() on the cookie jar set with setCookieJar() to obtain the cookies to be sent to the remote server.
The returned object must be in an open state.
new QNetworkReply QtNetwork.QNetworkAccessManager.DeleteResource | ( | QNetworkRequest | request | ) |
Sends a request to delete the resource identified by the URL of request.
Note: This feature is currently available for HTTP only, performing an HTTP DELETE request.
This function was introduced in Qt 4.6.
See also get(), post(), put(), and sendCustomRequest().
new void QtNetwork.QNetworkAccessManager.Dispose | ( | ) |
new QNetworkReply QtNetwork.QNetworkAccessManager.Get | ( | QNetworkRequest | request | ) |
Posts a request to obtain the contents of the target request and returns a new QNetworkReply object opened for reading which emits the readyRead() signal whenever new data arrives.
The contents as well as associated headers will be downloaded.
See also post(), put(), deleteResource(), and sendCustomRequest().
new QNetworkReply QtNetwork.QNetworkAccessManager.Head | ( | QNetworkRequest | request | ) |
Posts a request to obtain the network headers for request and returns a new QNetworkReply object which will contain such headers.
The function is named after the HTTP request associated (HEAD).
|
protected |
This signal is emitted whenever a final server requests authentication before it delivers the requested contents. The slot connected to this signal should fill the credentials for the contents (which can be determined by inspecting the reply object) in the authenticator object.
QNetworkAccessManager will cache the credentials internally and will send the same values if the server requires authentication again, without emitting the authenticationRequired() signal. If it rejects the credentials, this signal will be emitted again.
Note: It is not possible to use a QueuedConnection to connect to this signal, as the connection will fail if the authenticator has not been filled in with new information when the signal returns.
See also proxyAuthenticationRequired().
|
protected |
This signal is emitted whenever a pending network reply is finished. The reply parameter will contain a pointer to the reply that has just finished. This signal is emitted in tandem with the QNetworkReply::finished() signal.
See QNetworkReply::finished() for information on the status that the object will be in.
Note: Do not delete the reply object in the slot connected to this signal. Use deleteLater().
See also QNetworkReply::finished() and QNetworkReply::error().
|
protected |
This signal is emitted when the value of the networkAccessible property changes. accessible is the new network accessibility.
|
protected |
|
protected |
This signal is emitted whenever a proxy requests authentication and QNetworkAccessManager cannot find a valid, cached credential. The slot connected to this signal should fill in the credentials for the proxy proxy in the authenticator object.
QNetworkAccessManager will cache the credentials internally. The next time the proxy requests authentication, QNetworkAccessManager will automatically send the same credential without emitting the proxyAuthenticationRequired signal again.
If the proxy rejects the credentials, QNetworkAccessManager will emit the signal again.
See also proxy(), setProxy(), and authenticationRequired().
|
protected |
This signal is emitted if the SSL/TLS session encountered errors during the set up, including certificate verification errors. The errors parameter contains the list of errors and reply is the QNetworkReply that is encountering these errors.
To indicate that the errors are not fatal and that the connection should proceed, the QNetworkReply::ignoreSslErrors() function should be called from the slot connected to this signal. If it is not called, the SSL session will be torn down before any data is exchanged (including the URL).
This signal can be used to display an error message to the user indicating that security may be compromised and display the SSL settings (see sslConfiguration() to obtain it). If the user decides to proceed after analyzing the remote certificate, the slot should call ignoreSslErrors().
See also QSslSocket::sslErrors(), QNetworkReply::sslErrors(), QNetworkReply::sslConfiguration(), and QNetworkReply::ignoreSslErrors().
new QNetworkReply QtNetwork.QNetworkAccessManager.Post | ( | QNetworkRequest | request, |
QIODevice | data | ||
) |
Sends an HTTP POST request to the destination specified by request and returns a new QNetworkReply object opened for reading that will contain the reply sent by the server. The contents of the data device will be uploaded to the server.
data must be open for reading and must remain valid until the finished() signal is emitted for this reply.
Note: Sending a POST request on protocols other than HTTP and HTTPS is undefined and will probably fail.
See also get(), put(), deleteResource(), and sendCustomRequest().
new QNetworkReply QtNetwork.QNetworkAccessManager.Post | ( | QNetworkRequest | request, |
QByteArray | data | ||
) |
This is an overloaded function.
Sends the contents of the data byte array to the destination specified by request.
new QNetworkReply QtNetwork.QNetworkAccessManager.Post | ( | QNetworkRequest | request, |
QHttpMultiPart | multiPart | ||
) |
This is an overloaded function.
Sends the contents of the multiPart message to the destination specified by request.
This can be used for sending MIME multipart messages over HTTP.
This function was introduced in Qt 4.8.
See also QHttpMultiPart, QHttpPart, and put().
new QNetworkReply QtNetwork.QNetworkAccessManager.Put | ( | QNetworkRequest | request, |
QIODevice | data | ||
) |
Uploads the contents of data to the destination request and returnes a new QNetworkReply object that will be open for reply.
data must be opened for reading when this function is called and must remain valid until the finished() signal is emitted for this reply.
Whether anything will be available for reading from the returned object is protocol dependent. For HTTP, the server may send a small HTML page indicating the upload was successful (or not). Other protocols will probably have content in their replies.
Note: For HTTP, this request will send a PUT request, which most servers do not allow. Form upload mechanisms, including that of uploading files through HTML forms, use the POST mechanism.
See also get(), post(), deleteResource(), and sendCustomRequest().
new QNetworkReply QtNetwork.QNetworkAccessManager.Put | ( | QNetworkRequest | request, |
QByteArray | data | ||
) |
This is an overloaded function.
Sends the contents of the data byte array to the destination specified by request.
new QNetworkReply QtNetwork.QNetworkAccessManager.Put | ( | QNetworkRequest | request, |
QHttpMultiPart | multiPart | ||
) |
This is an overloaded function.
Sends the contents of the multiPart message to the destination specified by request.
This can be used for sending MIME multipart messages over HTTP.
This function was introduced in Qt 4.8.
See also QHttpMultiPart, QHttpPart, and post().
new QNetworkReply QtNetwork.QNetworkAccessManager.SendCustomRequest | ( | QNetworkRequest | request, |
QByteArray | verb, | ||
QIODevice | data = null |
||
) |
Sends a custom request to the server identified by the URL of request.
It is the user's responsibility to send a verb to the server that is valid according to the HTTP specification.
This method provides means to send verbs other than the common ones provided via get() or post() etc., for instance sending an HTTP OPTIONS command.
If data is not empty, the contents of the data device will be uploaded to the server; in that case, data must be open for reading and must remain valid until the finished() signal is emitted for this reply.
Note: This feature is currently available for HTTP(S) only.
This function was introduced in Qt 4.7.
See also get(), post(), put(), and deleteResource().
|
static |
|
static |
|
static |
|
static |
|
addremove |
This signal is emitted whenever a final server requests authentication before it delivers the requested contents. The slot connected to this signal should fill the credentials for the contents (which can be determined by inspecting the reply object) in the authenticator object.
QNetworkAccessManager will cache the credentials internally and will send the same values if the server requires authentication again, without emitting the authenticationRequired() signal. If it rejects the credentials, this signal will be emitted again.
Note: It is not possible to use a QueuedConnection to connect to this signal, as the connection will fail if the authenticator has not been filled in with new information when the signal returns.
See also proxyAuthenticationRequired().
|
getset |
Returns the cache that is used to store data obtained from the network.
This function was introduced in Qt 4.5.
Sets the manager's network cache to be the cache specified. The cache is used for all requests dispatched by the manager.
Use this function to set the network cache object to a class that implements additional features, like saving the cookies to permanent storage.
Note: QNetworkAccessManager takes ownership of the cache object.
QNetworkAccessManager by default does not have a set cache. Qt provides a simple disk cache, QNetworkDiskCache, which can be used.
This function was introduced in Qt 4.5.
|
getset |
Returns the network configuration that will be used to create the network session which will be used when processing network requests.
This function was introduced in Qt 4.7.
Sets the network configuration that will be used when creating the network session to config.
The network configuration is used to create and open a network session before any request that requires network access is process. If no network configuration is explicitly set via this function the network configuration returned by QNetworkConfigurationManager::defaultConfiguration() will be used.
To restore the default network configuration set the network configuration to the value returned from QNetworkConfigurationManager::defaultConfiguration().
QNetworkConfigurationManager manager;
networkAccessManager->setConfiguration(manager.defaultConfiguration());
If an invalid network configuration is set, a network session will not be created. In this case network requests will be processed regardless, but may fail. For example:
networkAccessManager->setConfiguration(QNetworkConfiguration());
This function was introduced in Qt 4.7.
|
getset |
Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cookies that are about to be sent.
Sets the manager's cookie jar to be the cookieJar specified. The cookie jar is used by all requests dispatched by the manager.
Use this function to set the cookie jar object to a class that implements additional features, like saving the cookies to permanent storage.
Note: QNetworkAccessManager takes ownership of the cookieJar object.
If cookieJar is in the same thread as this QNetworkAccessManager, it will set the parent of the cookieJar so that the cookie jar is deleted when this object is deleted as well. If you want to share cookie jars between different QNetworkAccessManager objects, you may want to set the cookie jar's parent to 0 after calling this function.
QNetworkAccessManager by default does not implement any cookie policy of its own: it accepts all cookies sent by the server, as long as they are well formed and meet the minimum security requirements (cookie domain matches the request's and cookie path matches the request's). In order to implement your own security policy, override the QNetworkCookieJar::cookiesForUrl() and QNetworkCookieJar::setCookiesFromUrl() virtual functions. Those functions are called by QNetworkAccessManager when it detects a new cookie.
|
getprotected |
|
addremove |
This signal is emitted whenever a pending network reply is finished. The reply parameter will contain a pointer to the reply that has just finished. This signal is emitted in tandem with the QNetworkReply::finished() signal.
See QNetworkReply::finished() for information on the status that the object will be in.
Note: Do not delete the reply object in the slot connected to this signal. Use deleteLater().
See also QNetworkReply::finished() and QNetworkReply::error().
|
getset |
This property holds whether the network is currently accessible via this network access manager.
If the network is not accessible the network access manager will not process any new network requests, all such requests will fail with an error. Requests with URLs with the file:// scheme will still be processed.
By default the value of this property reflects the physical state of the device. Applications may override it to disable all network requests via this network access manager by calling
networkAccessManager->setNetworkAccessible(QNetworkAccessManager::NotAccessible);
Network requests can be reenabled again by calling
networkAccessManager->setNetworkAccessible(QNetworkAccessManager::Accessible);
Note: Calling setNetworkAccessible() does not change the network state.
This property was introduced in Qt 4.7.
|
addremove |
This signal is emitted when the value of the networkAccessible property changes. accessible is the new network accessibility.
|
addremove |
|
getset |
Returns the QNetworkProxy that the requests sent using this QNetworkAccessManager object will use. The default value for the proxy is QNetworkProxy::DefaultProxy.
Sets the proxy to be used in future requests to be proxy. This does not affect requests that have already been sent. The proxyAuthenticationRequired() signal will be emitted if the proxy requests authentication.
A proxy set with this function will be used for all requests issued by QNetworkAccessManager. In some cases, it might be necessary to select different proxies depending on the type of request being sent or the destination host. If that's the case, you should consider using setProxyFactory().
|
addremove |
This signal is emitted whenever a proxy requests authentication and QNetworkAccessManager cannot find a valid, cached credential. The slot connected to this signal should fill in the credentials for the proxy proxy in the authenticator object.
QNetworkAccessManager will cache the credentials internally. The next time the proxy requests authentication, QNetworkAccessManager will automatically send the same credential without emitting the proxyAuthenticationRequired signal again.
If the proxy rejects the credentials, QNetworkAccessManager will emit the signal again.
See also proxy(), setProxy(), and authenticationRequired().
|
getset |
Returns the proxy factory that this QNetworkAccessManager object is using to determine the proxies to be used for requests.
Note that the pointer returned by this function is managed by QNetworkAccessManager and could be deleted at any time.
This function was introduced in Qt 4.5.
Sets the proxy factory for this class to be factory. A proxy factory is used to determine a more specific list of proxies to be used for a given request, instead of trying to use the same proxy value for all requests.
All queries sent by QNetworkAccessManager will have type QNetworkProxyQuery::UrlRequest.
For example, a proxy factory could apply the following rules:
if the target address is in the local network (for example, if the hostname contains no dots or if it's an IP address in the organization's range), return QNetworkProxy::NoProxy
if the request is FTP, return an FTP proxy
if the request is HTTP or HTTPS, then return an HTTP proxy
otherwise, return a SOCKSv5 proxy server
The lifetime of the object factory will be managed by QNetworkAccessManager. It will delete the object when necessary.
Note: If a specific proxy is set with setProxy(), the factory will not be used.
This function was introduced in Qt 4.5.
|
addremove |
This signal is emitted if the SSL/TLS session encountered errors during the set up, including certificate verification errors. The errors parameter contains the list of errors and reply is the QNetworkReply that is encountering these errors.
To indicate that the errors are not fatal and that the connection should proceed, the QNetworkReply::ignoreSslErrors() function should be called from the slot connected to this signal. If it is not called, the SSL session will be torn down before any data is exchanged (including the URL).
This signal can be used to display an error message to the user indicating that security may be compromised and display the SSL settings (see sslConfiguration() to obtain it). If the user decides to proceed after analyzing the remote certificate, the slot should call ignoreSslErrors().
See also QSslSocket::sslErrors(), QNetworkReply::sslErrors(), QNetworkReply::sslConfiguration(), and QNetworkReply::ignoreSslErrors().
|
staticget |