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(java.lang.String, java.lang.String)
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
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theAcceptCertificateCallback
callback.static interface
Functional interface declaration of theAuthenticateCallback
callback.static class
Message.Builder<B extends Message.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theContentSniffedCallback
callback.static interface
Functional interface declaration of theFinishedCallback
callback.static interface
Functional interface declaration of theGotBodyCallback
callback.static interface
Functional interface declaration of theGotBodyDataCallback
callback.static interface
Functional interface declaration of theGotHeadersCallback
callback.static interface
Functional interface declaration of theGotInformationalCallback
callback.static interface
Functional interface declaration of theHstsEnforcedCallback
callback.static class
static interface
Functional interface declaration of theNetworkEventCallback
callback.static interface
Functional interface declaration of theRequestCertificateCallback
callback.static interface
Functional interface declaration of theRequestCertificatePasswordCallback
callback.static interface
Functional interface declaration of theRestartedCallback
callback.static interface
Functional interface declaration of theStartingCallback
callback.static interface
Functional interface declaration of theWroteBodyCallback
callback.static interface
Functional interface declaration of theWroteBodyDataCallback
callback.static interface
Functional interface declaration of theWroteHeadersCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionMessage
(MemorySegment address) Create a Message proxy instance for the provided memory address.Creates a new emptySoupMessage
, which will connect touri
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFlags
(Set<MessageFlags> flags) Addsflags
to the set of this Message's flags.void
addFlags
(MessageFlags... flags) Addsflags
to the set of this Message's flags.int
addHeaderHandler
(String signal, String header, Callback callback) Adds a signal handler to this Message forsignal
.int
addStatusCodeHandler
(String signal, int statusCode, Callback callback) Adds a signal handler to this Message forsignal
.protected Message
asParent()
Returns this instance as if it were its parent type.static Message.Builder
<? extends Message.Builder> builder()
AMessage.Builder
object constructs aMessage
with the specified properties.void
disableFeature
(Type featureType) Disables the actions ofSessionFeature
s with the givenfeatureType
(or a subclass of that type) on this Message.boolean
emitAcceptCertificate
(TlsCertificate tlsPeerCertificate, Set<TlsCertificateFlags> tlsPeerErrors) Emits the "accept-certificate" signal.boolean
emitAuthenticate
(Auth auth, boolean retrying) Emits the "authenticate" signal.void
emitContentSniffed
(String type, HashTable<String, String> params) Emits the "content-sniffed" signal.void
Emits the "finished" signal.void
Emits the "got-body" signal.void
emitGotBodyData
(int chunkSize) Emits the "got-body-data" signal.void
Emits the "got-headers" signal.void
Emits the "got-informational" signal.void
Emits the "hsts-enforced" signal.void
emitNetworkEvent
(SocketClientEvent event, IOStream connection) Emits the "network-event" signal.boolean
emitRequestCertificate
(TlsClientConnection tlsConnection) Emits the "request-certificate" signal.boolean
emitRequestCertificatePassword
(TlsPassword tlsPassword) Emits the "request-certificate-password" signal.void
Emits the "restarted" signal.void
Emits the "starting" signal.void
Emits the "wrote-body" signal.void
emitWroteBodyData
(int chunkSize) Emits the "wrote-body-data" signal.void
Emits the "wrote-headers" signal.static Message
fromEncodedForm
(String method, String uriString, String encodedForm) Creates a newSoupMessage
and sets it up to send the givenencodedForm
touri
viamethod
.static Message
fromMultipart
(String uriString, Multipart multipart) Creates a newSoupMessage
and sets it up to sendmultipart
touriString
via POST.static Message
Creates a new emptySoupMessage
, which will connect touri
.long
Returns the unique idenfier for the last connection used.Gets this Message's first-partyGLib.Uri
.getFlags()
Gets the flags on this Message.boolean
Returns whether HTTP/1 version is currently demanded for the this Message send.Gets the HTTP version of this Message.boolean
Gets whether this Message is intended to be used to sendOPTIONS *
to a server.boolean
Returns if this message is set as a top level navigation.Returns the method of this message.Get theMessageMetrics
of this Message.Retrieves theMessagePriority
.Returns the reason phrase for the status of this message.Get the remoteSocketAddress
of the connection associated with the message.Returns the headers sent with the request.Returns the headers recieved with the response.Gets this Message's site for cookiesGUri
.Returns the set status of this message.Gets the name of the TLS ciphersuite negotiated for this Message's connection.Gets the peer'sTlsCertificate
associated with this Message's connection.Gets the errors associated with validating this Message's TLS peer certificate.Gets the TLS protocol version negotiated for this Message's connection.static Type
getType()
Get the GType of the Message classgetUri()
Gets this Message's URI.boolean
isFeatureDisabled
(Type featureType) Get whetherSessionFeature
s of the givenfeatureType
(or a subclass of that type) are disabled on this Message.boolean
Determines whether or not this Message's connection can be kept alive for further requests after processing this Message.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.static Message
optionsPing
(Uri baseUri) Creates a newSoupMessage
to sendOPTIONS *
to a server.boolean
queryFlags
(Set<MessageFlags> flags) Queries ifflags
are present in the set of this Message's flags.boolean
queryFlags
(MessageFlags... flags) Queries ifflags
are present in the set of this Message's flags.void
removeFlags
(Set<MessageFlags> flags) Removesflags
from the set of this Message's flags.void
removeFlags
(MessageFlags... flags) Removesflags
from the set of this Message's flags.void
setFirstParty
(Uri firstParty) SetsfirstParty
as the main documentGUri
for this Message.void
setFlags
(Set<MessageFlags> flags) Sets the specified flags on this Message.void
setFlags
(MessageFlags... flags) Sets the specified flags on this Message.void
setForceHttp1
(boolean value) Sets whether HTTP/1 version should be used when sending this message.void
setIsOptionsPing
(boolean isOptionsPing) Set whether this Message is intended to be used to sendOPTIONS *
to a server.void
setIsTopLevelNavigation
(boolean isTopLevelNavigation) Sets whether the current request is a top-level navitation.void
Set this Message's HTTP method tomethod
.void
setPriority
(MessagePriority priority) Sets the priority of a message.void
setRequestBody
(@Nullable String contentType, @Nullable InputStream stream, long contentLength) Set the request body of aSoupMessage
.void
setRequestBodyFromBytes
(@Nullable String contentType, @Nullable Bytes bytes) Set the request body of aSoupMessage
fromGLib.Bytes
.void
setSiteForCookies
(@Nullable Uri siteForCookies) SetssiteForCookies
as the policy URL for same-site cookies for this Message.void
setTlsClientCertificate
(@Nullable TlsCertificate certificate) Sets thecertificate
to be used by this Message's connection when a client certificate is requested during the TLS handshake.void
Sets this Message's URI touri
.void
Completes 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
Creates a new emptySoupMessage
, which will connect touri
.- Parameters:
method
- the HTTP method for the created requesturiString
- the destination endpoint (as a string)- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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 newSoupMessage
and sets it up to send the givenencodedForm
touri
viamethod
. Ifmethod
is "GET", it will include the form data intouri
's query field, and ifmethod
is "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
, ornull
ifuriString
could not be parsed ormethod
is not "GET, "POST" or "PUT" - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
fromMultipart
Creates a newSoupMessage
and sets it up to sendmultipart
touriString
via POST.- Parameters:
uriString
- the destination endpointmultipart
- aSoupMultipart
- Returns:
- the new
SoupMessage
, ornull
ifuriString
could not be parsed - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
fromUri
Creates a new emptySoupMessage
, which will connect touri
.- Parameters:
method
- the HTTP method for the created requesturi
- the destination endpoint- Returns:
- the new
SoupMessage
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
optionsPing
Creates a newSoupMessage
to sendOPTIONS *
to a server. The path ofbaseUri
will be ignored.- Parameters:
baseUri
- the destination endpoint- Returns:
- the new
SoupMessage
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
addFlags
Addsflags
to the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
addFlags
Addsflags
to the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
addHeaderHandler
Adds a signal handler to this Message forsignal
.Similar to
org.gnome.gobject.GObjects#signalConnect
, but thecallback
will only be run if this Message's incoming 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 thecallback
will only be run if this Message has the statusstatusCode
.signal
must be a signal that will be emitted after this Message's status 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 ofSessionFeature
s with the givenfeatureType
(or a subclass of that type) on this Message.this Message is processed as though the feature(s) hadn't been added to the session. Eg, passing
SOUP_TYPE_CONTENT_SNIFFER
forfeatureType
will 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
- theGType
of 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
Gets this Message's first-partyGLib.Uri
.- Returns:
- the this Message's first party
GUri
-
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,false
otherwise.
-
getHttpVersion
Gets the HTTP version of this Message.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:
true
if the message is options ping, orfalse
otherwise
-
getMethod
Returns the method of this message.- Returns:
- A method such as
SOUP_METHOD_GET
-
getMetrics
Get theMessageMetrics
of this Message.If the flag
MessageFlags.COLLECT_METRICS
is 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 remoteSocketAddress
of the connection associated with the message.The returned address can be
null
if 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-connectable
is set the returned address id for the connection to the session's remote connectable.- Returns:
- a
GSocketAddress
ornull
if 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
Gets this Message's site for cookiesGUri
.- Returns:
- the this Message's site for cookies
GUri
-
getStatus
-
getTlsCiphersuiteName
Gets the name of the TLS ciphersuite negotiated for this Message's connection.- Returns:
- the name of the TLS ciphersuite,
or
null
if this Message's connection is not SSL.
-
getTlsPeerCertificate
Gets the peer'sTlsCertificate
associated with this Message's connection.Note that this is not set yet during the emission of
Message::accept-certificate
signal.- Returns:
- this Message's TLS peer certificate,
or
null
if this Message's connection is not SSL.
-
getTlsPeerCertificateErrors
Gets the errors associated with validating this Message's TLS peer certificate. Note that this is not set yet during the emission ofMessage::accept-certificate
signal.- Returns:
- a
GTlsCertificateFlags
with this Message's TLS peer certificate errors.
-
getTlsProtocolVersion
Gets the TLS protocol version negotiated for this Message's connection.If the message connection is not SSL,
TlsProtocolVersion.UNKNOWN
is returned.- Returns:
- a
GTlsProtocolVersion
-
getUri
-
isFeatureDisabled
Get whetherSessionFeature
s of the givenfeatureType
(or a subclass of that type) are disabled on this Message.- Parameters:
featureType
- theGType
of aSoupSessionFeature
- Returns:
true
if feature is disabled, orfalse
otherwise.
-
isKeepalive
public boolean isKeepalive()Determines whether or not this Message's connection can be kept alive for further requests after processing this Message.The result is based on the HTTP version, Connection header, etc.
- Returns:
true
orfalse
.
-
queryFlags
Queries ifflags
are present in the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values- Returns:
true
ifflags
are enabled in this Message
-
queryFlags
Queries ifflags
are present in the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values- Returns:
true
ifflags
are enabled in this Message
-
removeFlags
Removesflags
from the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
removeFlags
Removesflags
from the set of this Message's flags.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
setFirstParty
SetsfirstParty
as the main documentGUri
for this Message.For details of when and how this is used refer to the documentation for
CookieJarAcceptPolicy
.- Parameters:
firstParty
- theGUri
for the this Message's first party
-
setFlags
Sets the specified flags on this Message.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
setFlags
Sets the specified flags on this Message.- Parameters:
flags
- a set ofSoupMessageFlags
values
-
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
-
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:uri
will be ignored andMessage:method
set toSOUP_METHOD_OPTIONS
.- Parameters:
isOptionsPing
- the value to set
-
setMethod
Set this Message's HTTP 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 @Nullable String contentType, @Nullable @Nullable InputStream stream, long contentLength) Set the request body of aSoupMessage
.If
contentType
isnull
andstream
is notnull
the 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, ornull
if unknownstream
- aGInputStream
to read the request body fromcontentLength
- the byte length ofstream
or -1 if unknown
-
setRequestBodyFromBytes
public void setRequestBodyFromBytes(@Nullable @Nullable String contentType, @Nullable @Nullable Bytes bytes) Set the request body of aSoupMessage
fromGLib.Bytes
.If
contentType
isnull
andbytes
is notnull
the 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, ornull
if unknownbytes
- aGBytes
with the request body data
-
setSiteForCookies
SetssiteForCookies
as the policy URL for same-site cookies for this Message.It is either the URL of the top-level document or
null
depending 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
- theGUri
for the this Message's site for cookies
-
setTlsClientCertificate
Sets thecertificate
to be used by this Message's connection when a client certificate is requested during the TLS handshake.You can call this as a response to
Message::request-certificate
signal, or before the connection is started. Ifcertificate
isnull
the handshake will continue without providing a GTlsCertificate. Note that theTlsCertificate
set by this function will be ignored ifSession:tls-interaction
is notnull
.- Parameters:
certificate
- theGTlsCertificate
to set, ornull
-
setUri
Sets this Message's URI 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-password
signal, to notify this Message that theTlsPassword
has already been updated. -
onAcceptCertificate
public SignalConnection<Message.AcceptCertificateCallback> onAcceptCertificate(Message.AcceptCertificateCallback handler) 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:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAcceptCertificate
public boolean emitAcceptCertificate(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, 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:
- 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
, andtype
isnull
.- 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
- 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
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:
- 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
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:
- 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 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:
- 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 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:
- 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
's connection TLS handshake whentlsConnection
requests 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 returningtrue
and callsetTlsClientCertificate(org.gnome.gio.TlsCertificate)
later once the certificate is available. Note that this signal is not emitted ifSession:tls-interaction
was 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
's connection TLS handshake whentlsConnection
requests a certificate password from the client.You can set the certificate password on
password
, then calltlsClientCertificatePasswordRequestComplete()
and returntrue
to handle the signal synchronously. It's possible to handle the request asynchornously by callingGObject.ref()
onpassword
, then returningtrue
and calltlsClientCertificatePasswordRequestComplete()
later after setting the password onpassword
. Note that this signal is not emitted ifSession:tls-interaction
was 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.Builder
object constructs aMessage
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withMessage.Builder.build()
.
-