Class Message.Builder<B extends Message.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
Message
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theMessage
object.Emitted during themsg
's connection TLS handshake after an unacceptable TLS certificate has been received.Emitted when the message requires authentication.This signal is emitted afterMessage::got-headers
.onFinished
(Message.FinishedCallback handler) Emitted when all HTTP processing is finished for a message.onGotBody
(Message.GotBodyCallback handler) Emitted after receiving the complete message response body.onGotBodyData
(Message.GotBodyDataCallback handler) Emitted after reading a portion of the message body from the network.onGotHeaders
(Message.GotHeadersCallback handler) Emitted after receiving the Status-Line and response headers.Emitted after receiving a 1xx (Informational) response for a (client-side) message.Emitted whenHSTSEnforcer
has upgraded the protocol formsg
to HTTPS as a result of matching its domain with a HSTS policy.Emitted to indicate that some network-related event related tomsg
has occurred.Emitted during themsg
's connection TLS handshake whentlsConnection
requests a certificate from the client.Emitted during themsg
's connection TLS handshake whentlsConnection
requests a certificate password from the client.onRestarted
(Message.RestartedCallback handler) Emitted when a request that was already sent once is now being sent again.onStarting
(Message.StartingCallback handler) Emitted just before a message is sent.onWroteBody
(Message.WroteBodyCallback handler) Emitted immediately after writing the complete body for a message.Emitted immediately after writing a portion of the message body to the network.Emitted immediately after writing the request headers for a message.setFirstParty
(Uri firstParty) TheGLib.Uri
loaded in the application when the message was queued.setFlags
(Set<MessageFlags> flags) Various message options.setFlags
(MessageFlags... flags) Various message options.setIsOptionsPing
(boolean isOptionsPing) Whether the message is an OPTIONS ping.setIsTopLevelNavigation
(boolean isTopLevelNavigation) Set when the message is navigating between top level domains.The message's HTTP method.setPriority
(MessagePriority priority) Sets the priority of theSoupMessage
.setSiteForCookies
(Uri siteForCookies) Site used to compare cookies against.The message's Request-URI.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theMessage
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toMessage
.- Overrides:
build
in classGObject.Builder<B extends Message.Builder<B>>
- Returns:
- a new instance of
Message
with the properties that were set in the Builder object. - Throws:
UnsupportedPlatformException
- when run on an unsupported platform
-
setFirstParty
-
setFlags
Various message options.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setIsOptionsPing
Whether the message is an OPTIONS ping.The
SoupMessage
is intended to be used to sendOPTIONS *
to a server. When set totrue
, the path ofMessage:uri
will be ignored andMessage:method
set toSOUP_METHOD_OPTIONS
.- Parameters:
isOptionsPing
- the value for theis-options-ping
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMethod
-
setPriority
Sets the priority of theSoupMessage
. SeeMessage.setPriority(org.gnome.soup.MessagePriority)
for further details.- Parameters:
priority
- the value for thepriority
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setSiteForCookies
-
setUri
-
setFlags
Various message options.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onAcceptCertificate
Emitted during themsg
's connection TLS handshake after an unacceptable TLS certificate has been received.You can return
true
to accepttlsCertificate
despitetlsErrors
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onAuthenticate
Emitted when the message requires authentication.If credentials are available call
Auth.authenticate(java.lang.String, java.lang.String)
onauth
. If these credentials fail, the signal will be emitted again, withretrying
set totrue
, which will continue until you return without callingAuth.authenticate(java.lang.String, java.lang.String)
onauth
.Note that this may be emitted before
msg
's body has been fully read.You can authenticate
auth
asynchronously by callingGObject.ref()
onauth
and returningtrue
. The operation will complete once eitherAuth.authenticate(java.lang.String, java.lang.String)
orAuth.cancel()
are called.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onContentSniffed
This signal is emitted afterMessage::got-headers
.If content sniffing is disabled, or no content sniffing will be performed, due to the sniffer deciding to trust the Content-Type sent by the server, this signal is emitted immediately after
Message::got-headers
, andtype
isnull
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onFinished
Emitted when all HTTP processing is finished for a message.(After
Message::got_body
).- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onGotBody
Emitted after receiving the complete message response body.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onGotBodyData
Emitted after reading a portion of the message body from the network.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onGotHeaders
Emitted after receiving the Status-Line and response headers.See also
Message.addHeaderHandler(java.lang.String, java.lang.String, org.gnome.gobject.Callback)
andMessage.addStatusCodeHandler(java.lang.String, int, org.gnome.gobject.Callback)
, which can be used to connect to a subset of emissions of this signal.If you cancel or requeue
msg
while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, andmsg
's connection will be closed. (If you need to requeue a message--eg, after handling authentication or redirection--it is usually better to requeue it from aMessage::got-body
handler rather than aMessage::got_headers
handler, so that the existing HTTP connection can be reused.)- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onGotInformational
Emitted after receiving a 1xx (Informational) response for a (client-side) message.The response_headers will be filled in with the headers associated with the informational response; however, those header values will be erased after this signal is done.
If you cancel or requeue
msg
while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, andmsg
's connection will be closed.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onHstsEnforced
Emitted whenHSTSEnforcer
has upgraded the protocol formsg
to HTTPS as a result of matching its domain with a HSTS policy.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onNetworkEvent
Emitted to indicate that some network-related event related tomsg
has occurred.This essentially proxies the
Gio.SocketClient::event
signal, but only for events that occur whilemsg
"owns" the connection; ifmsg
is sent on an existing persistent connection, then this signal will not be emitted. (If you want to force the message to be sent on a new connection, set theMessageFlags.NEW_CONNECTION
flag on it.)See
Gio.SocketClient::event
for more information on what the different values ofevent
correspond to, and whatconnection
will be in each case.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRequestCertificate
Emitted during themsg
's connection TLS handshake whentlsConnection
requests a certificate from the client.You can set the client certificate by calling
Message.setTlsClientCertificate(org.gnome.gio.TlsCertificate)
and returningtrue
. It's possible to handle the request asynchornously by returningtrue
and callMessage.setTlsClientCertificate(org.gnome.gio.TlsCertificate)
later once the certificate is available. Note that this signal is not emitted ifSession:tls-interaction
was set, or ifMessage.setTlsClientCertificate(org.gnome.gio.TlsCertificate)
was called before the connection TLS handshake started.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRequestCertificatePassword
Emitted during themsg
's connection TLS handshake whentlsConnection
requests a certificate password from the client.You can set the certificate password on
password
, then callMessage.tlsClientCertificatePasswordRequestComplete()
and returntrue
to handle the signal synchronously. It's possible to handle the request asynchornously by callingGObject.ref()
onpassword
, then returningtrue
and callMessage.tlsClientCertificatePasswordRequestComplete()
later after setting the password onpassword
. Note that this signal is not emitted ifSession:tls-interaction
was set.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRestarted
Emitted when a request that was already sent once is now being sent again.e.g. because the first attempt received a redirection response, or because we needed to use authentication.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onStarting
Emitted just before a message is sent.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onWroteBody
Emitted immediately after writing the complete body for a message.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onWroteBodyData
Emitted immediately after writing a portion of the message body to the network.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onWroteHeaders
Emitted immediately after writing the request headers for a message.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-