Class Message
- All Implemented Interfaces:
Proxy
A SoupMessage represents an HTTP message that is being sent or
received.
You would create a SoupMessage with Message() or
fromUri(java.lang.String, org.gnome.glib.Uri), set up its fields appropriately, and send it.
Message:status-code will normally be a Status value, eg,
Status.OK, though of course it might actually be an unknown status
code. Message:reason-phrase is the actual text returned from the
server, which may or may not correspond to the "standard" description of
statusCode. At any rate, it is almost certainly not localized, and not very
descriptive even if it is in the user's language; you should not use
Message:reason-phrase in user-visible messages. Rather, you should
look at Message:status-code, and determine an end-user-appropriate
message based on that and on what you were trying to do.
Note that libsoup's terminology here does not quite match the HTTP
specification: in RFC 2616, an "HTTP-message" is either a Request, or a
Response. In libsoup, a SoupMessage combines both the request and the
response.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theAcceptCertificateCallbackcallback.static interfaceFunctional interface declaration of theAuthenticateCallbackcallback.static classMessage.Builder<B extends Message.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theContentSniffedCallbackcallback.static interfaceFunctional interface declaration of theFinishedCallbackcallback.static interfaceFunctional interface declaration of theGotBodyCallbackcallback.static interfaceFunctional interface declaration of theGotBodyDataCallbackcallback.static interfaceFunctional interface declaration of theGotHeadersCallbackcallback.static interfaceFunctional interface declaration of theGotInformationalCallbackcallback.static interfaceFunctional interface declaration of theHstsEnforcedCallbackcallback.static classstatic interfaceFunctional interface declaration of theNetworkEventCallbackcallback.static interfaceFunctional interface declaration of theRequestCertificateCallbackcallback.static interfaceFunctional interface declaration of theRequestCertificatePasswordCallbackcallback.static interfaceFunctional interface declaration of theRestartedCallbackcallback.static interfaceFunctional interface declaration of theStartingCallbackcallback.static interfaceFunctional interface declaration of theWroteBodyCallbackcallback.static interfaceFunctional interface declaration of theWroteBodyDataCallbackcallback.static interfaceFunctional interface declaration of theWroteHeadersCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFlags(Set<MessageFlags> flags) Addsflagsto the set ofmsg'sflags.voidaddFlags(MessageFlags... flags) Addsflagsto the set ofmsg'sflags.intaddHeaderHandler(String signal, String header, @Nullable Callback callback) Adds a signal handler to this Message forsignal.intaddStatusCodeHandler(String signal, int statusCode, @Nullable Callback callback) Adds a signal handler to this Message forsignal.protected MessageasParent()Returns this instance as if it were its parent type.static Message.Builder<? extends Message.Builder> builder()AMessage.Builderobject constructs aMessagewith the specified properties.voiddisableFeature(Type featureType) Disables the actions ofSessionFeatures with the givenfeatureType(or a subclass of that type) onmsg.booleanemitAcceptCertificate(@Nullable TlsCertificate tlsPeerCertificate, Set<TlsCertificateFlags> tlsPeerErrors) Emits the "accept-certificate" signal.booleanemitAuthenticate(@Nullable Auth auth, boolean retrying) Emits the "authenticate" signal.voidemitContentSniffed(String type, @Nullable HashTable<String, String> params) Emits the "content-sniffed" signal.voidEmits the "finished" signal.voidEmits the "got-body" signal.voidemitGotBodyData(int chunkSize) Emits the "got-body-data" signal.voidEmits the "got-headers" signal.voidEmits the "got-informational" signal.voidEmits the "hsts-enforced" signal.voidemitNetworkEvent(SocketClientEvent event, @Nullable IOStream connection) Emits the "network-event" signal.booleanemitRequestCertificate(@Nullable TlsClientConnection tlsConnection) Emits the "request-certificate" signal.booleanemitRequestCertificatePassword(@Nullable TlsPassword tlsPassword) Emits the "request-certificate-password" signal.voidEmits the "restarted" signal.voidEmits the "starting" signal.voidEmits the "wrote-body" signal.voidemitWroteBodyData(int chunkSize) Emits the "wrote-body-data" signal.voidEmits the "wrote-headers" signal.static MessagefromEncodedForm(String method, String uriString, String encodedForm) Creates a newSoupMessageand sets it up to send the givenencodedFormtouriviamethod.Ifmethodis "GET", it will include the form data intouri'squery field, and ifmethodis "POST" or "PUT", it will be set as request body.static MessagefromMultipart(String uriString, Multipart multipart) Creates a newSoupMessageand sets it up to sendmultiparttouriStringvia POST.static MessageCreates a new emptySoupMessage, which will connect touri.longReturns the unique idenfier for the last connection used.Getsmsg'sfirst-partyGLib.Uri.getFlags()Gets the flags onmsg.booleanReturns whether HTTP/1 version is currently demanded for the this Message send.Gets the HTTP version ofmsg.booleanGets whether this Message is intended to be used to sendOPTIONS *to a server.booleanReturns if this message is set as a top level navigation.Returns the method of this message.@Nullable MessageMetricsGet theMessageMetricsofmsg.Retrieves theMessagePriority.@Nullable StringReturns the reason phrase for the status of this message.@Nullable SocketAddressGet the remoteSocketAddressof the connection associated with the message.Returns the headers sent with the request.Returns the headers recieved with the response.Getsmsg'ssite for cookiesGUri.Returns the set status of this message.Gets the name of the TLS ciphersuite negotiated formsg'sconnection.@Nullable TlsCertificateGets the peer'sTlsCertificateassociated withmsg'sconnection.Gets the errors associated with validatingmsg'sTLS peer certificate.Gets the TLS protocol version negotiated formsg'sconnection.static @Nullable TypegetType()Get the GType of the Message classgetUri()Getsmsg'sURI.booleanisFeatureDisabled(Type featureType) Get whetherSessionFeatures of the givenfeatureType(or a subclass of that type) are disabled onmsg.booleanDetermines whether or notmsg'sconnection can be kept alive for further requests after processingmsg.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.static MessageoptionsPing(Uri baseUri) Creates a newSoupMessageto sendOPTIONS *to a server.booleanqueryFlags(Set<MessageFlags> flags) Queries ifflagsare present in the set ofmsg'sflags.booleanqueryFlags(MessageFlags... flags) Queries ifflagsare present in the set ofmsg'sflags.voidremoveFlags(Set<MessageFlags> flags) Removesflagsfrom the set ofmsg'sflags.voidremoveFlags(MessageFlags... flags) Removesflagsfrom the set ofmsg'sflags.voidsetFirstParty(Uri firstParty) SetsfirstPartyas the main documentGUriformsg.voidsetFlags(Set<MessageFlags> flags) Sets the specified flags onmsg.voidsetFlags(MessageFlags... flags) Sets the specified flags onmsg.voidsetForceHttp1(boolean value) Sets whether HTTP/1 version should be used when sending this message.voidsetIsOptionsPing(boolean isOptionsPing) Set whether this Message is intended to be used to sendOPTIONS *to a server.voidsetIsTopLevelNavigation(boolean isTopLevelNavigation) Sets whether the current request is a top-level navitation.voidSetmsg'sHTTP method tomethod.voidsetPriority(MessagePriority priority) Sets the priority of a message.voidsetRequestBody(@Nullable String contentType, @Nullable InputStream stream, long contentLength) Set the request body of aSoupMessage.voidsetRequestBodyFromBytes(@Nullable String contentType, byte @Nullable [] bytes) Set the request body of aSoupMessagefromGLib.Bytes.voidsetSiteForCookies(@Nullable Uri siteForCookies) SetssiteForCookiesas the policy URL for same-site cookies formsg.voidsetTlsClientCertificate(@Nullable TlsCertificate certificate) Sets thecertificateto be used bymsg'sconnection when a client certificate is requested during the TLS handshake.voidSetsmsg'sURI touri.voidCompletes a certificate password request.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
-
Message
Create a Message proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Message
-
Message
public Message()Creates a new Message.
-
-
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. -
fromEncodedForm
Creates a newSoupMessageand sets it up to send the givenencodedFormtouriviamethod.Ifmethodis "GET", it will include the form data intouri'squery field, and ifmethodis "POST" or "PUT", it will be set as request body.This function takes the ownership of
encodedForm,that will be released withGLib.free(java.lang.foreign.MemorySegment)when no longer in use. See alsoSoup.formEncode(java.lang.String, java.lang.Object...),Soup.formEncodeHash(org.gnome.glib.HashTable<java.lang.String, java.lang.String>)andSoup.formEncodeDatalist(org.gnome.glib.Data[]).- Parameters:
method- the HTTP method for the created request (GET, POST or PUT)uriString- the destination endpoint (as a string)encodedForm- a encoded form- Returns:
- the new
SoupMessage, ornullifuriStringcould not be parsed ormethodis not "GET, "POST" or "PUT"
-
fromMultipart
Creates a newSoupMessageand sets it up to sendmultiparttouriStringvia POST.- Parameters:
uriString- the destination endpointmultipart- aSoupMultipart- Returns:
- the new
SoupMessage, ornullifuriStringcould not be parsed
-
fromUri
-
optionsPing
-
addFlags
Addsflagsto the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
addFlags
Addsflagsto the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
addHeaderHandler
Adds a signal handler to this Message forsignal.Similar to
org.gnome.gobject.GObjects#signalConnect, but thecallbackwill only be run ifmsg'sincoming messages headers (that is, therequest_headers) contain a header namedheader.- Parameters:
signal- signal to connect the handler to.header- HTTP response header to match againstcallback- the header handler- Returns:
- the handler ID from
org.gnome.gobject.GObjects#signalConnect
-
addStatusCodeHandler
Adds a signal handler to this Message forsignal.Similar to
org.gnome.gobject.GObjects#signalConnect, but thecallbackwill only be run if this Message has the statusstatusCode.signalmust be a signal that will be emitted aftermsg'sstatus is set (this means it can't be a "wrote" signal).- Parameters:
signal- signal to connect the handler to.statusCode- status code to match againstcallback- the header handler- Returns:
- the handler ID from
org.gnome.gobject.GObjects#signalConnect
-
disableFeature
Disables the actions ofSessionFeatures with the givenfeatureType(or a subclass of that type) onmsg.this Message is processed as though the feature(s) hadn't been added to the session. Eg, passing
SOUP_TYPE_CONTENT_SNIFFERforfeatureTypewill disable Content-Type sniffing on the message.You must call this before queueing this Message on a session; calling it on a message that has already been queued is undefined. In particular, you cannot call this on a message that is being requeued after a redirect or authentication.
- Parameters:
featureType- theGTypeof aSoupSessionFeature
-
getConnectionId
public long getConnectionId()Returns the unique idenfier for the last connection used.This may be 0 if it was a cached resource or it has not gotten a connection yet.
- Returns:
- An id or 0 if no connection.
-
getFirstParty
-
getFlags
-
getForceHttp1
public boolean getForceHttp1()Returns whether HTTP/1 version is currently demanded for the this Message send.- Returns:
true, when HTTP/1 is demanded,falseotherwise.- Since:
- 3.4
-
getHttpVersion
Gets the HTTP version ofmsg.This is the minimum of the version from the request and the version from the response.
- Returns:
- the HTTP version
-
getIsOptionsPing
public boolean getIsOptionsPing()Gets whether this Message is intended to be used to sendOPTIONS *to a server.- Returns:
trueif the message is options ping, orfalseotherwise
-
getMethod
Returns the method of this message.- Returns:
- A method such as
SOUP_METHOD_GET
-
getMetrics
Get theMessageMetricsofmsg.If the flag
MessageFlags.COLLECT_METRICSis not enabled for this Message this will returnnull.- Returns:
- a
SoupMessageMetrics
-
getPriority
Retrieves theMessagePriority.If not set this value defaults to
SOUP_MESSAGE_PRIORITY_NORMAL.- Returns:
- the priority of the message.
-
getReasonPhrase
Returns the reason phrase for the status of this message.- Returns:
- the phrase
-
getRemoteAddress
Get the remoteSocketAddressof the connection associated with the message.The returned address can be
nullif the connection hasn't been established yet, or the resource was loaded from the disk cache. In case of proxy connections, the remote address returned is aProxyAddress. IfSession:remote-connectableis set the returned address id for the connection to the session's remote connectable.- Returns:
- a
GSocketAddressornullif the connection hasn't been established
-
getRequestHeaders
Returns the headers sent with the request.- Returns:
- The
SoupMessageHeaders
-
getResponseHeaders
Returns the headers recieved with the response.- Returns:
- The
SoupMessageHeaders
-
getSiteForCookies
Getsmsg'ssite for cookiesGUri.- Returns:
- the
msg'ssite for cookiesGUri
-
getStatus
-
getTlsCiphersuiteName
Gets the name of the TLS ciphersuite negotiated formsg'sconnection.- Returns:
- the name of the TLS ciphersuite,
or
nullifmsg'sconnection is not SSL.
-
getTlsPeerCertificate
Gets the peer'sTlsCertificateassociated withmsg'sconnection.Note that this is not set yet during the emission of
Message::accept-certificatesignal.- Returns:
msg'sTLS peer certificate, ornullifmsg'sconnection is not SSL.
-
getTlsPeerCertificateErrors
Gets the errors associated with validatingmsg'sTLS peer certificate. Note that this is not set yet during the emission ofMessage::accept-certificatesignal.- Returns:
- a
GTlsCertificateFlagswithmsg'sTLS peer certificate errors.
-
getTlsProtocolVersion
Gets the TLS protocol version negotiated formsg'sconnection.If the message connection is not SSL,
TlsProtocolVersion.UNKNOWNis returned.- Returns:
- a
GTlsProtocolVersion
-
getUri
-
isFeatureDisabled
Get whetherSessionFeatures of the givenfeatureType(or a subclass of that type) are disabled onmsg.- Parameters:
featureType- theGTypeof aSoupSessionFeature- Returns:
trueif feature is disabled, orfalseotherwise.
-
isKeepalive
public boolean isKeepalive()Determines whether or notmsg'sconnection can be kept alive for further requests after processingmsg.The result is based on the HTTP version, Connection header, etc.
- Returns:
trueorfalse.
-
queryFlags
Queries ifflagsare present in the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues- Returns:
trueifflagsare enabled in this Message
-
queryFlags
Queries ifflagsare present in the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues- Returns:
trueifflagsare enabled in this Message
-
removeFlags
Removesflagsfrom the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
removeFlags
Removesflagsfrom the set ofmsg'sflags.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
setFirstParty
SetsfirstPartyas the main documentGUriformsg.For details of when and how this is used refer to the documentation for
CookieJarAcceptPolicy.- Parameters:
firstParty- theGUrifor themsg'sfirst party
-
setFlags
Sets the specified flags onmsg.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
setFlags
Sets the specified flags onmsg.- Parameters:
flags- a set ofSoupMessageFlagsvalues
-
setForceHttp1
public void setForceHttp1(boolean value) Sets whether HTTP/1 version should be used when sending this message. Some connections can still override it, if needed.Note the value is unset after the message send is finished.
- Parameters:
value- value to set- Since:
- 3.4
-
setIsOptionsPing
public void setIsOptionsPing(boolean isOptionsPing) Set whether this Message is intended to be used to sendOPTIONS *to a server.When set to
true, the path ofMessage:uriwill be ignored andMessage:methodset toSOUP_METHOD_OPTIONS.- Parameters:
isOptionsPing- the value to set
-
setMethod
Setmsg'sHTTP method tomethod.- Parameters:
method- the value to set
-
setPriority
Sets the priority of a message.Note that this won't have any effect unless used before the message is added to the session's message processing queue.
The message will be placed just before any other previously added message with lower priority (messages with the same priority are processed on a FIFO basis).
Setting priorities does not currently work with synchronous messages because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling.
- Parameters:
priority- theSoupMessagePriority
-
setRequestBody
public void setRequestBody(@Nullable String contentType, @Nullable InputStream stream, long contentLength) Set the request body of aSoupMessage.If
contentTypeisnullandstreamis notnullthe Content-Type header will not be changed if present. The request body needs to be set again in case this Message is restarted (in case of redirection or authentication).- Parameters:
contentType- MIME Content-Type of the body, ornullif unknownstream- aGInputStreamto read the request body fromcontentLength- the byte length ofstreamor -1 if unknown
-
setRequestBodyFromBytes
Set the request body of aSoupMessagefromGLib.Bytes.If
contentTypeisnullandbytesis notnullthe Content-Type header will not be changed if present. The request body needs to be set again in case this Message is restarted (in case of redirection or authentication).- Parameters:
contentType- MIME Content-Type of the body, ornullif unknownbytes- aGByteswith the request body data
-
setSiteForCookies
SetssiteForCookiesas the policy URL for same-site cookies formsg.It is either the URL of the top-level document or
nulldepending on whether the registrable domain of this document's URL matches the registrable domain of its parent's/opener's URL. For the top-level document it is set to the document's URL.See the same-site spec for more information.
- Parameters:
siteForCookies- theGUrifor themsg'ssite for cookies
-
setTlsClientCertificate
Sets thecertificateto be used bymsg'sconnection when a client certificate is requested during the TLS handshake.You can call this as a response to
Message::request-certificatesignal, or before the connection is started. Ifcertificateisnullthe handshake will continue without providing a GTlsCertificate. Note that theTlsCertificateset by this function will be ignored ifSession:tls-interactionis notnull.- Parameters:
certificate- theGTlsCertificateto set, ornull
-
setUri
Setsmsg'sURI touri.If this Message has already been sent and you want to re-send it with the new URI, you need to send it again.
- Parameters:
uri- the newGUri
-
tlsClientCertificatePasswordRequestComplete
public void tlsClientCertificatePasswordRequestComplete()Completes a certificate password request.You must call this as a response to
Message::request-certificate-passwordsignal, to notify this Message that theTlsPasswordhas already been updated. -
onAcceptCertificate
public SignalConnection<Message.AcceptCertificateCallback> onAcceptCertificate(Message.AcceptCertificateCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAcceptCertificate
public boolean emitAcceptCertificate(@Nullable TlsCertificate tlsPeerCertificate, Set<TlsCertificateFlags> tlsPeerErrors) Emits the "accept-certificate" signal. SeeonAcceptCertificate(org.gnome.soup.Message.AcceptCertificateCallback). -
onAuthenticate
public SignalConnection<Message.AuthenticateCallback> onAuthenticate(Message.AuthenticateCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAuthenticate
Emits the "authenticate" signal. SeeonAuthenticate(org.gnome.soup.Message.AuthenticateCallback). -
onContentSniffed
public SignalConnection<Message.ContentSniffedCallback> onContentSniffed(Message.ContentSniffedCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitContentSniffed
Emits the "content-sniffed" signal. SeeonContentSniffed(org.gnome.soup.Message.ContentSniffedCallback). -
onFinished
Emitted when all HTTP processing is finished for a message.(After
Message::got_body).- 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.gnome.soup.Message.FinishedCallback). -
onGotBody
Emitted after receiving the complete message response body.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitGotBody
public void emitGotBody()Emits the "got-body" signal. SeeonGotBody(org.gnome.soup.Message.GotBodyCallback). -
onGotBodyData
public SignalConnection<Message.GotBodyDataCallback> onGotBodyData(Message.GotBodyDataCallback handler) Emitted after reading a portion of the message body from the network.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 3.4
- See Also:
-
emitGotBodyData
public void emitGotBodyData(int chunkSize) Emits the "got-body-data" signal. SeeonGotBodyData(org.gnome.soup.Message.GotBodyDataCallback). -
onGotHeaders
public SignalConnection<Message.GotHeadersCallback> onGotHeaders(Message.GotHeadersCallback handler) Emitted after receiving the Status-Line and response headers.See also
addHeaderHandler(java.lang.String, java.lang.String, org.gnome.gobject.Callback)andaddStatusCodeHandler(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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitGotHeaders
public void emitGotHeaders()Emits the "got-headers" signal. SeeonGotHeaders(org.gnome.soup.Message.GotHeadersCallback). -
onGotInformational
public SignalConnection<Message.GotInformationalCallback> onGotInformational(Message.GotInformationalCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitGotInformational
public void emitGotInformational()Emits the "got-informational" signal. SeeonGotInformational(org.gnome.soup.Message.GotInformationalCallback). -
onHstsEnforced
public SignalConnection<Message.HstsEnforcedCallback> onHstsEnforced(Message.HstsEnforcedCallback handler) Emitted whenHSTSEnforcerhas upgraded the protocol formsgto HTTPS as a result of matching its domain with a HSTS policy.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitHstsEnforced
public void emitHstsEnforced()Emits the "hsts-enforced" signal. SeeonHstsEnforced(org.gnome.soup.Message.HstsEnforcedCallback). -
onNetworkEvent
public SignalConnection<Message.NetworkEventCallback> onNetworkEvent(Message.NetworkEventCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitNetworkEvent
Emits the "network-event" signal. SeeonNetworkEvent(org.gnome.soup.Message.NetworkEventCallback). -
onRequestCertificate
public SignalConnection<Message.RequestCertificateCallback> onRequestCertificate(Message.RequestCertificateCallback handler) Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests a certificate from the client.You can set the client certificate by calling
setTlsClientCertificate(org.gnome.gio.TlsCertificate)and returningtrue. It's possible to handle the request asynchornously by returningtrueand callsetTlsClientCertificate(org.gnome.gio.TlsCertificate)later once the certificate is available. Note that this signal is not emitted ifSession:tls-interactionwas set, or ifsetTlsClientCertificate(org.gnome.gio.TlsCertificate)was called before the connection TLS handshake started.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitRequestCertificate
Emits the "request-certificate" signal. SeeonRequestCertificate(org.gnome.soup.Message.RequestCertificateCallback). -
onRequestCertificatePassword
public SignalConnection<Message.RequestCertificatePasswordCallback> onRequestCertificatePassword(Message.RequestCertificatePasswordCallback handler) Emitted during themsg'sconnection TLS handshake whentlsConnectionrequests a certificate password from the client.You can set the certificate password on
password,then calltlsClientCertificatePasswordRequestComplete()and returntrueto handle the signal synchronously. It's possible to handle the request asynchornously by callingGObject.ref()onpassword,then returningtrueand calltlsClientCertificatePasswordRequestComplete()later after setting the password onpassword.Note that this signal is not emitted ifSession:tls-interactionwas set.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitRequestCertificatePassword
Emits the "request-certificate-password" signal. SeeonRequestCertificatePassword(org.gnome.soup.Message.RequestCertificatePasswordCallback). -
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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitRestarted
public void emitRestarted()Emits the "restarted" signal. SeeonRestarted(org.gnome.soup.Message.RestartedCallback). -
onStarting
Emitted just before a message is sent.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitStarting
public void emitStarting()Emits the "starting" signal. SeeonStarting(org.gnome.soup.Message.StartingCallback). -
onWroteBody
Emitted immediately after writing the complete body for a message.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitWroteBody
public void emitWroteBody()Emits the "wrote-body" signal. SeeonWroteBody(org.gnome.soup.Message.WroteBodyCallback). -
onWroteBodyData
public SignalConnection<Message.WroteBodyDataCallback> onWroteBodyData(Message.WroteBodyDataCallback handler) Emitted immediately after writing a portion of the message body to the network.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitWroteBodyData
public void emitWroteBodyData(int chunkSize) Emits the "wrote-body-data" signal. SeeonWroteBodyData(org.gnome.soup.Message.WroteBodyDataCallback). -
onWroteHeaders
public SignalConnection<Message.WroteHeadersCallback> onWroteHeaders(Message.WroteHeadersCallback handler) Emitted immediately after writing the request headers for a message.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitWroteHeaders
public void emitWroteHeaders()Emits the "wrote-headers" signal. SeeonWroteHeaders(org.gnome.soup.Message.WroteHeadersCallback). -
builder
AMessage.Builderobject constructs aMessagewith the specified properties. Use the variousset...()methods to set properties, and finish construction withMessage.Builder.build().- Returns:
- the builder object
-