| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.WebKit2.Objects.WebResource
Description
Represents a resource at the end of a URI.
A WebResource encapsulates content for each resource at the
end of a particular URI. For example, one WebResource 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
WebResource, using webResourceGetUri and
webResourceGetResponse, as well as the raw data, using
webResourceGetData.
Synopsis
- newtype WebResource = WebResource (ManagedPtr WebResource)
- class (GObject o, IsDescendantOf WebResource o) => IsWebResource o
- toWebResource :: (MonadIO m, IsWebResource o) => o -> m WebResource
- webResourceGetData :: (HasCallStack, MonadIO m, IsWebResource a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- webResourceGetDataFinish :: (HasCallStack, MonadIO m, IsWebResource a, IsAsyncResult b) => a -> b -> m ByteString
- webResourceGetResponse :: (HasCallStack, MonadIO m, IsWebResource a) => a -> m (Maybe URIResponse)
- webResourceGetUri :: (HasCallStack, MonadIO m, IsWebResource a) => a -> m Text
- getWebResourceResponse :: (MonadIO m, IsWebResource o) => o -> m (Maybe URIResponse)
- getWebResourceUri :: (MonadIO m, IsWebResource o) => o -> m Text
- type WebResourceFailedCallback = GError -> IO ()
- afterWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedCallback) -> m SignalHandlerId
- onWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedCallback) -> m SignalHandlerId
- type WebResourceFailedWithTlsErrorsCallback = TlsCertificate -> [TlsCertificateFlags] -> IO ()
- afterWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedWithTlsErrorsCallback) -> m SignalHandlerId
- onWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedWithTlsErrorsCallback) -> m SignalHandlerId
- type WebResourceFinishedCallback = IO ()
- afterWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFinishedCallback) -> m SignalHandlerId
- onWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFinishedCallback) -> m SignalHandlerId
- type WebResourceReceivedDataCallback = Word64 -> IO ()
- afterWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceReceivedDataCallback) -> m SignalHandlerId
- onWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceReceivedDataCallback) -> m SignalHandlerId
- type WebResourceSentRequestCallback = URIRequest -> URIResponse -> IO ()
- afterWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceSentRequestCallback) -> m SignalHandlerId
- onWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceSentRequestCallback) -> m SignalHandlerId
Exported types
newtype WebResource Source #
Memory-managed wrapper type.
Constructors
| WebResource (ManagedPtr WebResource) |
Instances
| Eq WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource | |
| GObject WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource | |
| ManagedPtrNewtype WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource Methods toManagedPtr :: WebResource -> ManagedPtr WebResource | |
| TypedObject WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource | |
| HasParentTypes WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource | |
| IsGValue (Maybe WebResource) Source # | Convert |
Defined in GI.WebKit2.Objects.WebResource Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe WebResource -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe WebResource) | |
| type ParentTypes WebResource Source # | |
Defined in GI.WebKit2.Objects.WebResource type ParentTypes WebResource = '[Object] | |
class (GObject o, IsDescendantOf WebResource o) => IsWebResource o Source #
Type class for types which can be safely cast to WebResource, for instance with toWebResource.
Instances
| (GObject o, IsDescendantOf WebResource o) => IsWebResource o Source # | |
Defined in GI.WebKit2.Objects.WebResource | |
toWebResource :: (MonadIO m, IsWebResource o) => o -> m WebResource Source #
Cast to WebResource, for types for which this is known to be safe. For general casts, use castTo.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getDataFinish, getProperty, getQdata, getResponse, getUri.
Setters
getData
Arguments
| :: (HasCallStack, MonadIO m, IsWebResource a, IsCancellable b) | |
| => a |
|
| -> Maybe b |
|
| -> Maybe AsyncReadyCallback |
|
| -> m () |
Asynchronously get the raw data for resource.
When the operation is finished, callback will be called. You can then call
webResourceGetDataFinish to get the result of the operation.
getDataFinish
webResourceGetDataFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebResource a, IsAsyncResult b) | |
| => a |
|
| -> b |
|
| -> m ByteString | Returns: a
string with the data of |
Finish an asynchronous operation started with webResourceGetData.
getResponse
webResourceGetResponse Source #
Arguments
| :: (HasCallStack, MonadIO m, IsWebResource a) | |
| => a |
|
| -> m (Maybe URIResponse) | Returns: the |
Retrieves the URIResponse of the resource load operation.
This method returns Nothing if called before the response
is received from the server. You can connect to notifyresponse
signal to be notified when the response is received.
getUri
Arguments
| :: (HasCallStack, MonadIO m, IsWebResource a) | |
| => a |
|
| -> m Text | Returns: the current active URI of |
Returns the current active URI of resource.
The active URI might change during a load operation:
<orderedlist> <listitem><para> When the resource load starts, the active URI is the requested URI </para></listitem> <listitem><para> When the initial request is sent to the server, WebResource::sentRequest signal is emitted without a redirected response, the active URI is the URI of the request sent to the server. </para></listitem> <listitem><para> In case of a server redirection, WebResource::sentRequest signal is emitted again with a redirected response, the active URI is the URI the request was redirected to. </para></listitem> <listitem><para> When the response is received from the server, the active URI is the final one and it will not change again. </para></listitem> </orderedlist>
You can monitor the active URI by connecting to the notifyuri
signal of resource.
Properties
response
The URIResponse associated with this resource.
getWebResourceResponse :: (MonadIO m, IsWebResource o) => o -> m (Maybe URIResponse) Source #
Get the value of the “response” property.
When overloading is enabled, this is equivalent to
get webResource #response
uri
The current active URI of the WebResource.
See webResourceGetUri for more details.
getWebResourceUri :: (MonadIO m, IsWebResource o) => o -> m Text Source #
Get the value of the “uri” property.
When overloading is enabled, this is equivalent to
get webResource #uri
Signals
failed
type WebResourceFailedCallback Source #
Arguments
| = GError |
|
| -> IO () |
This signal is emitted when an error occurs during the resource load operation.
afterWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webResource #failed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebResourceFailed :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webResource #failed callback
failedWithTlsErrors
type WebResourceFailedWithTlsErrorsCallback Source #
Arguments
| = TlsCertificate |
|
| -> [TlsCertificateFlags] |
|
| -> IO () |
This signal is emitted when a TLS error occurs during the resource load operation.
Since: 2.8
afterWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedWithTlsErrorsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failedWithTlsErrors signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webResource #failedWithTlsErrors callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebResourceFailedWithTlsErrors :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFailedWithTlsErrorsCallback) -> m SignalHandlerId Source #
Connect a signal handler for the failedWithTlsErrors signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webResource #failedWithTlsErrors callback
finished
type WebResourceFinishedCallback = IO () Source #
This signal is emitted when the resource load finishes successfully or due to an error. In case of errors WebResource::failed signal is emitted before this one.
afterWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFinishedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the finished signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webResource #finished callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebResourceFinished :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceFinishedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the finished signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webResource #finished callback
receivedData
type WebResourceReceivedDataCallback Source #
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.
afterWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceReceivedDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the receivedData signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webResource #receivedData callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebResourceReceivedData :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceReceivedDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the receivedData signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webResource #receivedData callback
sentRequest
type WebResourceSentRequestCallback Source #
Arguments
| = URIRequest |
|
| -> URIResponse |
|
| -> IO () |
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
redirectedResponse parameter containing the response
received by the server for the initial request.
afterWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceSentRequestCallback) -> m SignalHandlerId Source #
Connect a signal handler for the sentRequest signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after webResource #sentRequest callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self parameter.
Note that this requires activating the ImplicitParams GHC extension.
onWebResourceSentRequest :: (IsWebResource a, MonadIO m) => a -> ((?self :: a) => WebResourceSentRequestCallback) -> m SignalHandlerId Source #
Connect a signal handler for the sentRequest signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on webResource #sentRequest callback