WebKitGTK+ Reference Manual: WebKitWebDataSource

## WebKitWebDataSource WebKitWebDataSource — Encapsulates the content to be displayed in a WebKitWebFrame. |

## Synopsis

                        WebKitWebDataSource;
    GString *           webkit_web_data_source_get_data     (WebKitWebDataSource *data_source);
    const gchar *       webkit_web_data_source_get_encoding (WebKitWebDataSource *data_source);
    WebKitNetworkRequest * webkit_web_data_source_get_initial_request
                                                            (WebKitWebDataSource *data_source);
    WebKitWebResource * webkit_web_data_source_get_main_resource
                                                            (WebKitWebDataSource *data_source);
    WebKitNetworkRequest * webkit_web_data_source_get_request
                                                            (WebKitWebDataSource *data_source);
    GList *             webkit_web_data_source_get_subresources
                                                            (WebKitWebDataSource *data_source);
    const gchar *       webkit_web_data_source_get_unreachable_uri
                                                            (WebKitWebDataSource *data_source);
    WebKitWebFrame *    webkit_web_data_source_get_web_frame
                                                            (WebKitWebDataSource *data_source);
    gboolean            webkit_web_data_source_is_loading   (WebKitWebDataSource *data_source);
    WebKitWebDataSource * webkit_web_data_source_new        (void);

## Object Hierarchy

      GObject
       +----WebKitWebDataSource

## Description

Data source encapsulates the content of a WebKitWebFrame. A WebKitWebFrame has a main resource and subresources and the data source provides access to these resources. When a request gets loaded initially, it is set to a provisional state. The application can request for the request that initiated the load by asking for the provisional data source and invoking the webkit_web_data_source_get_initial_request method of WebKitWebDataSource. This data source may not have enough data and some methods may return empty values. To get a "full" data source with the data and resources loaded, you need to get the non-provisional data source through WebKitWebFrame's webkit_web_frame_get_data_source method. This data source will have the data after everything was loaded. Make sure that the data source was finished loading before using any of its methods. You can do this via webkit_web_data_source_is_loading.

## Details

### WebKitWebDataSource

    typedef struct _WebKitWebDataSource WebKitWebDataSource;

### webkit_web_data_source_get_data ()

    GString *           webkit_web_data_source_get_data     (WebKitWebDataSource *data_source);

Returns the raw data that represents the the frame's content.The data will be incomplete until the data has finished loading. Returns `NULL` if the web frame hasn't loaded any data. Use webkit_web_data_source_is_loading to test if data source is in the process of loading.

`data_source` : | a WebKitWebDataSource
Returns : | a GString which contains the raw data that represents the `data_source` or `NULL` if the `data_source` hasn't loaded any data. [transfer none]

Since 1.1.14

### webkit_web_data_source_get_encoding ()

    const gchar *       webkit_web_data_source_get_encoding (WebKitWebDataSource *data_source);

Returns the text encoding name as set in the WebKitWebView, or if not, the text encoding of the response.

`data_source` : | a WebKitWebDataSource
Returns : | the encoding name of the WebKitWebView or of the response.

Since 1.1.14

### webkit_web_data_source_get_initial_request ()

    WebKitNetworkRequest * webkit_web_data_source_get_initial_request
                                                            (WebKitWebDataSource *data_source);

Returns a reference to the original request that was used to load the web content. The WebKitNetworkRequest returned by this method is the request prior to the "committed" load state. See webkit_web_data_source_get_request for getting the "committed" request.

`data_source` : | a WebKitWebDataSource
Returns : | the original WebKitNetworkRequest. [transfer none]

Since 1.1.14

### webkit_web_data_source_get_main_resource ()

    WebKitWebResource * webkit_web_data_source_get_main_resource
                                                            (WebKitWebDataSource *data_source);

Returns the main resource of the `data_source`

`data_source` : | a WebKitWebDataSource
Returns : | a new WebKitWebResource representing the main resource of the `data_source`. [transfer none]

Since 1.1.14

### webkit_web_data_source_get_request ()

    WebKitNetworkRequest * webkit_web_data_source_get_request
                                                            (WebKitWebDataSource *data_source);

Returns a WebKitNetworkRequest that was used to create this WebKitWebDataSource. The WebKitNetworkRequest returned by this method is the request that was "committed", and hence, different from the request you get from the webkit_web_data_source_get_initial_request method.

`data_source` : | a WebKitWebDataSource
Returns : | the WebKitNetworkRequest that created the `data_source` or `NULL` if the `data_source` is not attached to the frame or the frame hasn't been loaded. [transfer none]

Since 1.1.14

### webkit_web_data_source_get_subresources ()

    GList *             webkit_web_data_source_get_subresources
                                                            (WebKitWebDataSource *data_source);

Gives you a GList of WebKitWebResource objects that compose the WebKitWebView to which this WebKitWebDataSource is attached.

`data_source` : | a WebKitWebDataSource
Returns : | a GList of WebKitWebResource objects; the objects are owned by WebKit, but the GList must be freed. [element-type WebKitWebResource][transfer container]

Since 1.1.15

### webkit_web_data_source_get_unreachable_uri ()

    const gchar *       webkit_web_data_source_get_unreachable_uri
                                                            (WebKitWebDataSource *data_source);

Return the unreachable URI of `data_source`. The `data_source` will have an unreachable URL if it was created using WebKitWebFrame's webkit_web_frame_load_alternate_html_string method.

`data_source` : | a WebKitWebDataSource
Returns : | the unreachable URL of `data_source` or `NULL` if there is no unreachable URL.

Since 1.1.14

### webkit_web_data_source_get_web_frame ()

    WebKitWebFrame *    webkit_web_data_source_get_web_frame
                                                            (WebKitWebDataSource *data_source);

Returns the WebKitWebFrame that represents this data source

`data_source` : | a WebKitWebDataSource
Returns : | the WebKitWebFrame that represents the `data_source`. The WebKitWebFrame is owned by WebKit and should not be freed or destroyed. This will return `NULL` if the `data_source` is not attached to a frame. [transfer none]

Since 1.1.14

### webkit_web_data_source_is_loading ()

    gboolean            webkit_web_data_source_is_loading   (WebKitWebDataSource *data_source);

Determines whether the data source is in the process of loading its content.

`data_source` : | a WebKitWebDataSource
Returns : | `TRUE` if the `data_source` is still loading, `FALSE` otherwise

Since 1.1.14

### webkit_web_data_source_new ()

    WebKitWebDataSource * webkit_web_data_source_new        (void);

Creates a new WebKitWebDataSource instance. The URL of the WebKitWebDataSource will be set to "about:blank".

Returns : | a new WebKitWebDataSource.

Since 1.1.14

## See Also

WebKitWebFrame