1.44 <WebKitWebResource>

Class: <WebKitWebResource>

It derives from <GObject>.

Represents a resource at the end of a URI.

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 web-resource:get-uri and web-resource:get-response, as well as the raw data, using web-resource:get-data.

Properties

Property: web-resource:response self

The <WebKitURIResponse> associated with this resource.

Its value is a <WebKitURIResponse>, or #f.

It is read only.

Property: web-resource:uri self

The current active URI of the <WebKitWebResource>. See web-resource:get-uri for more details.

Its value is a string, or #f.

It is read only.

Procedures

Method: web-resource:get-data self [cancellable] [callback]
Method: get-data self [cancellable] [callback]

Asynchronously get the raw data for self.

When the operation is finished, callback will be called. You can then call web-resource:get-data-finish to get the result of the operation.

self

Passed: a <WebKitWebResource>.

a <WebKitWebResource>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: web-resource:get-data-finish self result ⇒ %return
Method: get-data-finish self result ⇒ %return

Finish an asynchronous operation started with web-resource:get-data.

self

Passed: a <WebKitWebResource>.

a <WebKitWebResource>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a bytevector.

a string with the data of self, or #f in case of error. if length is not #f, the size of the data will be assigned to it.

length

Not returned: it is the length of %return.

return location for the length of the resource data

Method: web-resource:get-response self ⇒ %return
Method: get-response self ⇒ %return

Retrieves the <WebKitURIResponse> of the resource load operation.

This method returns #f 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.

self

Passed: a <WebKitWebResource>.

a <WebKitWebResource>

%return

Returned: a <WebKitURIResponse>.

the <WebKitURIResponse>, or #f if the response hasn’t been received yet.

Method: web-resource:get-uri self ⇒ %return
Method: get-uri self ⇒ %return

Returns the current active URI of self.

The active URI might change during a load operation:

  1. When the resource load starts, the active URI is the requested URI
  2. When the initial request is sent to the server, web-resource:sent-request signal is emitted without a redirected response, the active URI is the URI of the request sent to the server.
  3. In case of a server redirection, web-resource:sent-request signal is emitted again with a redirected response, the active URI is the URI the request was redirected to.
  4. 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 self.

self

Passed: a <WebKitWebResource>.

a <WebKitWebResource>

%return

Returned: a string.

the current active URI of self

Signals

Signal: web-resource:failed

Connect a handler with (connect object web-resource:failed handler). It is called as (handler self error).

This signal is emitted when an error occurs during the resource load operation.

self

Passed: a <WebKitWebResource>.

error

Passed: a <GError>.

the <GError> that was triggered

Signal: web-resource:failed-with-tls-errors

Connect a handler with (connect object web-resource:failed-with-tls-errors handler). It is called as (handler self certificate errors).

This signal is emitted when a TLS error occurs during the resource load operation.

self

Passed: a <WebKitWebResource>.

certificate

Passed: a <GTlsCertificate>.

a <GTlsCertificate>

errors

Passed: a <GTlsCertificateFlags>.

a <GTlsCertificateFlags> with the verification status of certificate

Signal: web-resource:finished

Connect a handler with (connect object web-resource:finished handler). It is called as (handler self).

This signal is emitted when the resource load finishes successfully or due to an error. In case of errors web-resource:failed signal is emitted before this one.

self

Passed: a <WebKitWebResource>.

Signal: web-resource:sent-request

Connect a handler with (connect object web-resource:sent-request handler). It is called as (handler self request redirected-response).

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.

self

Passed: a <WebKitWebResource>.

request

Passed: a <WebKitURIRequest>.

a <WebKitURIRequest>

redirected-response

Passed: a <WebKitURIResponse>.

a <WebKitURIResponse>, or #f