[webkit-qt] Checking the HTTP status code of more than one instance of QWebPage
jocelyn.turcotte at nokia.com
Fri Mar 30 08:05:09 PDT 2012
Hello list member,
you could have a look at subclassing QWebPage and overriding QWebPage::extension and QWebPage::supportsExtension ( http://qt-project.org/doc/qt-4.8/qwebpage.html#extension ).
Check for QWebPage::ErrorPageExtension and ErrorPageExtensionOption::domain == QWebPage::Http and then you can feed an appropriate output to ErrorPageExtensionReturn::content from a local file or resource.
This method is intended for providing a custom error page to display, but you could also try to handle the error for your app in there.
Worst case you can use different QNetworkAccessManagers, but you might get performance issues. Each of them might spawn threads of their own and I think that there is no global limit for parallel connections, only per-instance, so you might get scaling issues when using more than 5-10 of them under heavy load.
On Fri, 30 Mar 2012 11:44:17 -0300
ext Alexandre Pretyman <alexandre.pretyman at gmail.com> wrote:
> Hi list,
> I'm using Qt 4.8 release from QtSDK 1.1.5 and the QtWebKit API that comes
> with it.
> I'm checking the HTTP Status of a page loaded in a QWebFrame with code as
> described in this StackOverflow post:
> which essentially tells me to connect to
> SIGNAL(finished(QNetworkReply*)) on the QNetworkAccessManager assiciated
> with the QWebPage and examine reply->attribute(QNetworkRequest::
> HttpStatusCodeAttribute) to get the HTTP status code
> This has been working well since I've been using a single QWebPage, but now
> I need more than one instance of QWebPage running.
> Since the recommended practice is to have one QNetworkAcessManager per
> application, if I connect to SIGNAL(finished(QNetworkReply*)) , I
> understand I'll be getting QNetworkReply * from both instances, and won't
> be able to differentiate which came from which.
> How can I overcome this?
More information about the webkit-qt