[webkit-qt] Checking the HTTP status code of more than one instance of QWebPage
alexandre.pretyman at gmail.com
Fri Mar 30 08:40:17 PDT 2012
Thanks for answering, but I have indeed gone down that route, with no
results, so I thought it wasn't the right way to go.
I overload virtual bool supportsExtension ( Extension extension ) const;
qDebug() << "SupportsExtension" << extension;
and I overload: virtual bool extension ( Extension extension, const
ExtensionOption * option = 0, ExtensionReturn * output = 0 ); with:
if (extension == ErrorPageExtension)
const ErrorPageExtensionOption * errorPageOption =
static_cast<const ErrorPageExtensionOption *>(option);
qDebug() << "ErrorPageExtensionOption domain:" <<
errorPageOption->domain << " errorString:" <<
<< "error:" << errorPageOption->error << "URL:" <<
else // I know the message below is rubbish, it's just to print
something if it gets there
qDebug() << "Untreated extension:" << extension << " opts: "
<< option << " output: " << output;
And 100% positive they don't get called on HTTP status code 408 (for
Operation Timed Out) and I don't remember it being called for HTTP status
code 503 (Service Unavailable) either.
And the only thing I have logged for this is:
ErrorPageExtensionOption domain: 0 errorString: "Unknown error" error: 205
Extension 1 = QWebPage::ErrorPageExtension
domain 0 = QWebPage::QtNetwork
error 205 = QNetworkReply::ContentReSendError
But, as mentioned above, never for 408.
Any other hints?
On Fri, Mar 30, 2012 at 12:05 PM, Jocelyn Turcotte <
jocelyn.turcotte at nokia.com> wrote:
> 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
> > 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?
> > Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-qt