HTTP request/response manager that is redirect-aware.
More...
#include <qgshttptransaction.h>
Signals |
void | setProgress (int done, int total) |
| legacy code.
|
void | dataReadProgress (int theProgress) |
| Signal for progress update.
|
void | totalSteps (int theTotalSteps) |
| Signal for adjusted number of steps.
|
void | statusChanged (QString theStatusQString) |
| emit a signal to be caught by qgisapp and display a msg on status bar
|
Public Member Functions |
| QgsHttpTransaction (QString uri, QString proxyHost=QString(), int proxyPort=80, QString proxyUser=QString(), QString proxyPass=QString(), QNetworkProxy::ProxyType proxyType=QNetworkProxy::NoProxy, QString userName=QString(), QString password=QString()) |
| Constructor.
|
virtual | ~QgsHttpTransaction () |
| Destructor.
|
void | getAsynchronously () |
bool | getSynchronously (QByteArray &respondedContent, int redirections=0, const QByteArray *postData=0) |
| Gets the response synchronously.
|
QString | responseContentType () |
QString | errorString () |
| If an operation returns 0 (e.g.
|
void | setCredentials (const QString &username, const QString &password) |
| Set the credentials (username and password)
|
int | networkTimeout () const |
| Returns the network timeout in msec.
|
void | setNetworkTimeout (int msec) |
| Sets the network timeout in milliseconds.
|
Static Public Member Functions |
static bool | applyProxySettings (QHttp &http, const QString &url) |
| Apply proxy settings from QSettings to a http object.
|
Detailed Description
HTTP request/response manager that is redirect-aware.
This class extends the Qt QHttp concept by being able to recognise and respond to redirection responses (e.g. HTTP code 302)
Constructor & Destructor Documentation
QgsHttpTransaction::QgsHttpTransaction |
( |
QString |
uri, |
|
|
QString |
proxyHost = QString() , |
|
|
int |
proxyPort = 80 , |
|
|
QString |
proxyUser = QString() , |
|
|
QString |
proxyPass = QString() , |
|
|
QNetworkProxy::ProxyType |
proxyType = QNetworkProxy::NoProxy , |
|
|
QString |
userName = QString() , |
|
|
QString |
password = QString() |
|
) |
| |
QgsHttpTransaction::~QgsHttpTransaction |
( |
| ) |
|
|
virtual |
Member Function Documentation
void QgsHttpTransaction::abort |
( |
| ) |
|
|
slot |
Aborts the current transaction.
bool QgsHttpTransaction::applyProxySettings |
( |
QHttp & |
http, |
|
|
const QString & |
url |
|
) |
| |
|
static |
Apply proxy settings from QSettings to a http object.
- Returns
- true if proxy settings was applied, false else
void QgsHttpTransaction::dataFinished |
( |
int |
id, |
|
|
bool |
error |
|
) |
| |
|
slot |
void QgsHttpTransaction::dataHeaderReceived |
( |
const QHttpResponseHeader & |
resp | ) |
|
|
slot |
void QgsHttpTransaction::dataProgress |
( |
int |
done, |
|
|
int |
total |
|
) |
| |
|
slot |
void QgsHttpTransaction::dataReadProgress |
( |
int |
theProgress | ) |
|
|
signal |
Signal for progress update.
void QgsHttpTransaction::dataReceived |
( |
const QHttpResponseHeader & |
resp | ) |
|
|
slot |
void QgsHttpTransaction::dataStarted |
( |
int |
id | ) |
|
|
slot |
void QgsHttpTransaction::dataStateChanged |
( |
int |
state | ) |
|
|
slot |
QString QgsHttpTransaction::errorString |
( |
| ) |
|
If an operation returns 0 (e.g.
getSynchronously()), this function returns the text of the error associated with the failure. Interactive users of this provider can then, for example, call a QMessageBox to display the contents.
void QgsHttpTransaction::getAsynchronously |
( |
| ) |
|
bool QgsHttpTransaction::getSynchronously |
( |
QByteArray & |
respondedContent, |
|
|
int |
redirections = 0 , |
|
|
const QByteArray * |
postData = 0 |
|
) |
| |
Gets the response synchronously.
Note that signals will still be emitted while in this function.
The function returns false if there is an error while getting the response.
- Parameters
-
[out] | respondedContent | is replaced with the new content. |
[in] | redirections | is used to measure how many http redirections we've been through. Clients typically don't need to set this. |
| postData | data to send with the http message. This is only used for HTTP POST. If 0 then the request is done with HTTP GET. |
- Returns
- true in case of success
void QgsHttpTransaction::networkTimedOut |
( |
| ) |
|
|
slot |
int QgsHttpTransaction::networkTimeout |
( |
| ) |
const |
|
inline |
Returns the network timeout in msec.
QString QgsHttpTransaction::responseContentType |
( |
| ) |
|
void QgsHttpTransaction::setCredentials |
( |
const QString & |
username, |
|
|
const QString & |
password |
|
) |
| |
Set the credentials (username and password)
void QgsHttpTransaction::setNetworkTimeout |
( |
int |
msec | ) |
|
|
inline |
Sets the network timeout in milliseconds.
void QgsHttpTransaction::setProgress |
( |
int |
done, |
|
|
int |
total |
|
) |
| |
|
signal |
legacy code.
This signal is currently not emitted and only kept for API compatibility
void QgsHttpTransaction::statusChanged |
( |
QString |
theStatusQString | ) |
|
|
signal |
emit a signal to be caught by qgisapp and display a msg on status bar
void QgsHttpTransaction::totalSteps |
( |
int |
theTotalSteps | ) |
|
|
signal |
Signal for adjusted number of steps.
void QgsHttpTransaction::transactionFinished |
( |
bool |
error | ) |
|
|
slot |
The documentation for this class was generated from the following files: