QGIS API Documentation  2.9.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsHttpTransaction Class Reference

HTTP request/response manager that is redirect-aware. More...

#include <qgshttptransaction.h>

Inheritance diagram for QgsHttpTransaction:
Inheritance graph

Public Slots

void abort ()
 Aborts the current transaction. More...
void dataFinished (int id, bool error)
void dataHeaderReceived (const QHttpResponseHeader &resp)
void dataProgress (int done, int total)
void dataReceived (const QHttpResponseHeader &resp)
void dataStarted (int id)
void dataStateChanged (int state)
void networkTimedOut ()
void transactionFinished (bool error)


void dataReadProgress (int theProgress)
 Signal for progress update. More...
void setProgress (int done, int total)
 legacy code. More...
void statusChanged (QString theStatusQString)
 emit a signal to be caught by qgisapp and display a msg on status bar More...
void totalSteps (int theTotalSteps)
 Signal for adjusted number of steps. More...

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. More...
virtual ~QgsHttpTransaction ()
 Destructor. More...
QString errorString ()
 If an operation returns 0 (e.g. More...
void getAsynchronously ()
bool getSynchronously (QByteArray &respondedContent, int redirections=0, const QByteArray *postData=0)
 Gets the response synchronously. More...
int networkTimeout () const
 Returns the network timeout in msec. More...
QString responseContentType ()
void setCredentials (const QString &username, const QString &password)
 Set the credentials (username and password) More...
void setNetworkTimeout (int msec)
 Sets the network timeout in milliseconds. More...

Static Public Member Functions

static bool applyProxySettings (QHttp &http, const QString &url)
 Apply proxy settings from QSettings to a http object. More...

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)

Definition at line 36 of file qgshttptransaction.h.

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() 


Definition at line 38 of file qgshttptransaction.cpp.

QgsHttpTransaction::~QgsHttpTransaction ( )


Definition at line 75 of file qgshttptransaction.cpp.

Member Function Documentation

void QgsHttpTransaction::abort ( )

Aborts the current transaction.

Definition at line 565 of file qgshttptransaction.cpp.

bool QgsHttpTransaction::applyProxySettings ( QHttp &  http,
const QString &  url 

Apply proxy settings from QSettings to a http object.

true if proxy settings was applied, false else

Definition at line 508 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataFinished ( int  id,
bool  error 

Definition at line 343 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataHeaderReceived ( const QHttpResponseHeader &  resp)

Definition at line 268 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataProgress ( int  done,
int  total 

Definition at line 318 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataReadProgress ( int  theProgress)

Signal for progress update.

void QgsHttpTransaction::dataReceived ( const QHttpResponseHeader &  resp)

Definition at line 299 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataStarted ( int  id)

Definition at line 261 of file qgshttptransaction.cpp.

void QgsHttpTransaction::dataStateChanged ( int  state)

Definition at line 437 of file qgshttptransaction.cpp.

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.

Definition at line 503 of file qgshttptransaction.cpp.

void QgsHttpTransaction::getAsynchronously ( )

Definition at line 86 of file qgshttptransaction.cpp.

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.

[out]respondedContentis replaced with the new content.
[in]redirectionsis used to measure how many http redirections we've been through. Clients typically don't need to set this.
postDatadata to send with the http message. This is only used for HTTP POST. If 0 then the request is done with HTTP GET.
true in case of success

Definition at line 93 of file qgshttptransaction.cpp.

void QgsHttpTransaction::networkTimedOut ( )

Definition at line 490 of file qgshttptransaction.cpp.

int QgsHttpTransaction::networkTimeout ( ) const

Returns the network timeout in msec.

Definition at line 94 of file qgshttptransaction.h.

QString QgsHttpTransaction::responseContentType ( )

Definition at line 255 of file qgshttptransaction.cpp.

void QgsHttpTransaction::setCredentials ( const QString &  username,
const QString &  password 

Set the credentials (username and password)

Definition at line 81 of file qgshttptransaction.cpp.

void QgsHttpTransaction::setNetworkTimeout ( int  msec)

Sets the network timeout in milliseconds.

Definition at line 96 of file qgshttptransaction.h.

void QgsHttpTransaction::setProgress ( int  done,
int  total 

legacy code.

This signal is currently not emitted and only kept for API compatibility

void QgsHttpTransaction::statusChanged ( QString  theStatusQString)

emit a signal to be caught by qgisapp and display a msg on status bar

void QgsHttpTransaction::totalSteps ( int  theTotalSteps)

Signal for adjusted number of steps.

void QgsHttpTransaction::transactionFinished ( bool  error)

Definition at line 392 of file qgshttptransaction.cpp.

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