Top |
void | failed | Run Last |
void | failed-with-tls-errors | Run Last |
void | finished | Run Last |
void | received-data | Run Last |
void | sent-request | Run Last |
A WebKitWebResource encapsulates content for each resource at the end of a particular URI. For example, one WebKitWebResource will be created for each separate image and stylesheet when a page is loaded.
You can access the response and the URI for a given
WebKitWebResource, using webkit_web_resource_get_uri()
and
webkit_web_resource_get_response()
, as well as the raw data, using
webkit_web_resource_get_data()
.
const gchar *
webkit_web_resource_get_uri (WebKitWebResource *resource
);
Returns the current active URI of resource
. The active URI might change during
a load operation:
When the resource load starts, the active URI is the requested URI
When the initial request is sent to the server, “sent-request” signal is emitted without a redirected response, the active URI is the URI of the request sent to the server.
In case of a server redirection, “sent-request” signal is emitted again with a redirected response, the active URI is the URI the request was redirected to.
When the response is received from the server, the active URI is the final one and it will not change again.
You can monitor the active URI by connecting to the notify::uri
signal of resource
.
WebKitURIResponse *
webkit_web_resource_get_response (WebKitWebResource *resource
);
Retrieves the WebKitURIResponse of the resource load operation.
This method returns NULL
if called before the response
is received from the server. You can connect to notify::response
signal to be notified when the response is received.
void webkit_web_resource_get_data (WebKitWebResource *resource
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously get the raw data for resource
.
When the operation is finished, callback
will be called. You can then call
webkit_web_resource_get_data_finish()
to get the result of the operation.
resource |
||
cancellable |
a GCancellable or |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
guchar * webkit_web_resource_get_data_finish (WebKitWebResource *resource
,GAsyncResult *result
,gsize *length
,GError **error
);
Finish an asynchronous operation started with webkit_web_resource_get_data()
.
resource |
||
result |
||
length |
return location for the length of the resource data. |
[out][allow-none] |
error |
return location for error or |
“response”
property“response” WebKitURIResponse *
The WebKitURIResponse associated with this resource.
Flags: Read
“uri”
property“uri” gchar *
The current active URI of the WebKitWebResource.
See webkit_web_resource_get_uri()
for more details.
Flags: Read
Default value: NULL
“failed”
signalvoid user_function (WebKitWebResource *resource, gpointer error, gpointer user_data)
This signal is emitted when an error occurs during the resource load operation.
resource |
||
error |
the GError that was triggered |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“failed-with-tls-errors”
signalvoid user_function (WebKitWebResource *resource, GTlsCertificate *certificate, GTlsCertificateFlags errors, gpointer user_data)
This signal is emitted when a TLS error occurs during the resource load operation.
resource |
||
certificate |
||
errors |
a GTlsCertificateFlags with the verification status of |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.8
“finished”
signalvoid user_function (WebKitWebResource *resource, gpointer user_data)
This signal is emitted when the resource load finishes successfully or due to an error. In case of errors “failed” signal is emitted before this one.
Flags: Run Last
“received-data”
signalvoid user_function (WebKitWebResource *resource, guint64 data_length, gpointer user_data)
This signal is emitted after response is received, every time new data has been received. It's useful to know the progress of the resource load operation.
resource |
||
data_length |
the length of data received in bytes |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“sent-request”
signalvoid user_function (WebKitWebResource *resource, WebKitURIRequest *request, WebKitURIResponse *redirected_response, gpointer user_data)
This signal is emitted when request
has been sent to the
server. In case of a server redirection this signal is
emitted again with the request
argument containing the new
request sent to the server due to the redirection and the
redirected_response
parameter containing the response
received by the server for the initial request.
resource |
||
request |
||
redirected_response |
a WebKitURIResponse, or |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last