Class WebResource
- All Implemented Interfaces:
Proxy
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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWebResource.Builder<B extends WebResource.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theFailedCallbackcallback.static interfaceFunctional interface declaration of theFailedWithTlsErrorsCallbackcallback.static interfaceFunctional interface declaration of theFinishedCallbackcallback.static interfaceFunctional interface declaration of theSentRequestCallbackcallback.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new WebResource.WebResource(MemorySegment address) Create a WebResource proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected WebResourceasParent()Returns this instance as if it were its parent type.static WebResource.Builder<? extends WebResource.Builder> builder()AWebResource.Builderobject constructs aWebResourcewith the specified properties.voidemitFailed(@Nullable GError error) Emits the "failed" signal.voidemitFailedWithTlsErrors(@Nullable TlsCertificate certificate, Set<TlsCertificateFlags> errors) Emits the "failed-with-tls-errors" signal.voidEmits the "finished" signal.voidemitSentRequest(@Nullable URIRequest request, @Nullable URIResponse redirectedResponse) Emits the "sent-request" signal.voidgetData(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously get the raw data forresource.byte[]getDataFinish(AsyncResult result) Finish an asynchronous operation started with webkit_web_resource_get_data().Retrieves theWebKitURIResponseof the resource load operation.static @Nullable TypegetType()Get the GType of the WebResource classgetUri()Returns the current active URI ofresource.onFailed(WebResource.FailedCallback handler) This signal is emitted when an error occurs during the resource load operation.This signal is emitted when a TLS error occurs during the resource load operation.onFinished(WebResource.FinishedCallback handler) This signal is emitted when the resource load finishes successfully or due to an error.This signal is emitted whenrequesthas been sent to the server.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
WebResource
Create a WebResource proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
WebResource
public WebResource()Creates a new WebResource.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getData
Asynchronously get the raw data forresource.When the operation is finished,
callbackwill be called. You can then call webkit_web_resource_get_data_finish() to get the result of the operation.- Parameters:
cancellable- aGCancellableornullto ignorecallback- aGAsyncReadyCallbackto call when the request is satisfied
-
getDataFinish
Finish an asynchronous operation started with webkit_web_resource_get_data().- Parameters:
result- aGAsyncResult- Returns:
- a
string with the data of
resource,ornullin case of error. iflengthis notnull, the size of the data will be assigned to it. - Throws:
GErrorException- seeGError
-
getResponse
Retrieves theWebKitURIResponseof the resource load operation.This method returns
nullif called before the response is received from the server. You can connect to notify::response signal to be notified when the response is received.- Returns:
- the
WebKitURIResponse, ornullif the response hasn't been received yet.
-
getUri
Returns the current active URI ofresource.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,
WebKitWebResource::sent-request 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,WebKitWebResource::sent-request 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 notify::uri signal of
resource.- Returns:
- the current active URI of this WebResource
-
onFailed
This signal is emitted when an error occurs during the resource load operation.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFailed
Emits the "failed" signal. SeeonFailed(org.webkitgtk.WebResource.FailedCallback). -
onFailedWithTlsErrors
public SignalConnection<WebResource.FailedWithTlsErrorsCallback> onFailedWithTlsErrors(WebResource.FailedWithTlsErrorsCallback handler) This signal is emitted when a TLS error occurs during the resource load operation.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.8
- See Also:
-
emitFailedWithTlsErrors
public void emitFailedWithTlsErrors(@Nullable TlsCertificate certificate, Set<TlsCertificateFlags> errors) Emits the "failed-with-tls-errors" signal. SeeonFailedWithTlsErrors(org.webkitgtk.WebResource.FailedWithTlsErrorsCallback). -
onFinished
public SignalConnection<WebResource.FinishedCallback> onFinished(WebResource.FinishedCallback handler) This signal is emitted when the resource load finishes successfully or due to an error. In case of errorsWebKitWebResource::failed signal is emitted before this one.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFinished
public void emitFinished()Emits the "finished" signal. SeeonFinished(org.webkitgtk.WebResource.FinishedCallback). -
onSentRequest
public SignalConnection<WebResource.SentRequestCallback> onSentRequest(WebResource.SentRequestCallback handler) This signal is emitted whenrequesthas been sent to the server. In case of a server redirection this signal is emitted again with therequestargument containing the new request sent to the server due to the redirection and theredirectedResponseparameter containing the response received by the server for the initial request.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSentRequest
Emits the "sent-request" signal. SeeonSentRequest(org.webkitgtk.WebResource.SentRequestCallback). -
builder
AWebResource.Builderobject constructs aWebResourcewith the specified properties. Use the variousset...()methods to set properties, and finish construction withWebResource.Builder.build().- Returns:
- the builder object
-