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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theMessageobject.Emitted during themsg'sconnection 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 whenHSTSEnforcerhas upgraded the protocol formsgto HTTPS as a result of matching its domain with a HSTS policy.Emitted to indicate that some network-related event related tomsghas occurred.Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests a certificate from the client.Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests 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.Uriloaded 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
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theMessageobject. 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:
buildin classGObject.Builder<B extends Message.Builder<B>>- Returns:
- a new instance of
Messagewith the properties that were set in the Builder object.
-
setFirstParty
-
setFlags
Various message options.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setIsOptionsPing
Whether the message is an OPTIONS ping.The
SoupMessageis intended to be used to sendOPTIONS *to a server. When set totrue, the path ofMessage:uriwill be ignored andMessage:methodset toSOUP_METHOD_OPTIONS.- Parameters:
isOptionsPing- the value for theis-options-pingproperty- Returns:
- the
Builderinstance 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 thepriorityproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setSiteForCookies
-
setUri
-
setFlags
Various message options.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
onAcceptCertificate
Emitted during themsg'sconnection TLS handshake after an unacceptable TLS certificate has been received.You can return
trueto accepttlsCertificatedespitetlsErrors.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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, withretryingset 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'sbody has been fully read.You can authenticate
authasynchronously by callingGObject.ref()onauthand 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
Builderinstance 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, andtypeisnull.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onGotBody
Emitted after receiving the complete message response body.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - Since:
- 3.4
- 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
msgwhile processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, andmsg'sconnection 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-bodyhandler rather than aMessage::got_headershandler, so that the existing HTTP connection can be reused.)- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
msgwhile processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, andmsg'sconnection will be closed.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onHstsEnforced
Emitted whenHSTSEnforcerhas upgraded the protocol formsgto HTTPS as a result of matching its domain with a HSTS policy.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onNetworkEvent
Emitted to indicate that some network-related event related tomsghas occurred.This essentially proxies the
Gio.SocketClient::eventsignal, but only for events that occur whilemsg"owns" the connection; ifmsgis 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_CONNECTIONflag on it.)See
Gio.SocketClient::eventfor more information on what the different values ofeventcorrespond to, and whatconnectionwill be in each case.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onRequestCertificate
Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests 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 returningtrueand callMessage.setTlsClientCertificate(org.gnome.gio.TlsCertificate)later once the certificate is available. Note that this signal is not emitted ifSession:tls-interactionwas set, or ifMessage.setTlsClientCertificate(org.gnome.gio.TlsCertificate)was called before the connection TLS handshake started.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onRequestCertificatePassword
Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests a certificate password from the client.You can set the certificate password on
password,then callMessage.tlsClientCertificatePasswordRequestComplete()and returntrueto handle the signal synchronously. It's possible to handle the request asynchornously by callingGObject.ref()onpassword,then returningtrueand callMessage.tlsClientCertificatePasswordRequestComplete()later after setting the password onpassword.Note that this signal is not emitted ifSession:tls-interactionwas set.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onStarting
Emitted just before a message is sent.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
Builderinstance 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
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-