nx_video_source_sdk
1.0
Video Source SDK
|
Synchronous wrapper on top of QNetworkAccessManager. More...
#include <sync_http_client.h>
Public Member Functions | |
SyncHttpClient (QNetworkAccessManager *networkAccessManager, const QUrl &defaultUrl=QUrl(), int defaultPort=0, const QAuthenticator &defaultCredentials=QAuthenticator()) | |
SyncHttpClient (QNetworkAccessManager *networkAccessManager, const QString &defaultUrlStr, int defaultPort=0, const QAuthenticator &defaultCredentials=QAuthenticator()) | |
QNetworkReply::NetworkError | get (const QNetworkRequest &request) |
Perform GET request. More... | |
QNetworkReply::NetworkError | get (const QUrl &requestUrl) |
Same as another get. | |
QNetworkReply::NetworkError | get (const QString &requestUrl) |
Same as another get. | |
QByteArray | readWholeMessageBody () |
Reads whole message body. May block. | |
int | statusCode () const |
Holds http status code of prev request. Undefined, if get returned code different from QNetworkReply::NoError. | |
Static Public Attributes | |
static const int | HTTP_OK = 200 |
static const int | HTTP_BAD_REQUEST = 400 |
static const int | HTTP_NOT_AUTHORIZED = 401 |
Synchronous wrapper on top of QNetworkAccessManager.
Host and port can be specified at object construction, than get can accept only http path
SyncHttpClient::SyncHttpClient | ( | QNetworkAccessManager * | networkAccessManager, |
const QUrl & | defaultUrl = QUrl() , |
||
int | defaultPort = 0 , |
||
const QAuthenticator & | defaultCredentials = QAuthenticator() |
||
) |
networkAccessManager | This object MUST not be freed earlier, than SyncHttpClient object |
defaultUrl | Contains host and port to use if url passed to get does not contain host & port |
defaultPort | Used as default if defaultUrl does not contain port |
defaultCredentials | Used as default if defaultUrl does not contain user credentials |
QNetworkReply::NetworkError SyncHttpClient::get | ( | const QNetworkRequest & | request | ) |
Perform GET request.
Blocks till valid response has been received or an error occurred
request |