public final class Body extends java.lang.Object implements SessionOpen, java.lang.Comparable<Body>
The implementation of the <body/>
element in the http://jabber.org/protocol/httpbind
namespace.
The natural ordering of this class is ordering by request ids (RID).
This class is immutable.
Modifier and Type | Class and Description |
---|---|
static class |
Body.Builder
A builder for the body element.
|
static class |
Body.Condition
The implementation of the ‘condition’ attribute of the
<body/> wrapper element, which indicates an error reported by the connection manager. |
static class |
Body.Type
The implementation of the ‘type’ attribute of the
<body/> element. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACE
|
static java.lang.String |
XBOSH_NAMESPACE
urn:xmpp:xbosh
|
Modifier and Type | Method and Description |
---|---|
static Body.Builder |
builder()
Creates a builder for the body element.
|
int |
compareTo(Body o)
Compares this body with another body by using the request id.
|
java.lang.String |
getAccept()
The connection manager MAY include an ‘accept’ attribute in the session creation response element, to specify a comma-separated list of the content encodings it can decompress.
|
java.lang.Long |
getAck()
A client MAY include an ‘ack’ attribute (set to “1”) to indicate that it will be using acknowledgements throughout the session and that the absence of an ‘ack’ attribute in any request is meaningful.
|
java.lang.String |
getAuthId()
Gets the ‘authid’ attribute, which contains the value of the XMPP stream ID generated by the XMPP server.
|
java.lang.String |
getBoshVersion()
This attribute specifies the highest version of the BOSH protocol that the client supports.
|
java.util.List<java.nio.charset.Charset> |
getCharsets()
The connection manager MAY inform the client which encodings it can convert by setting the optional ‘charsets’ attribute in the session creation response element to a space-separated list of encodings.
|
Body.Condition |
getCondition()
Gets a terminal binding condition.
|
java.lang.String |
getContent()
Some clients are constrained to only accept HTTP responses with specific Content-Types (e.g., “text/html”).
|
Jid |
getFrom()
The
<body/> element of the first request MAY also possess a ‘from’ attribute, which specifies the originator of the first stream and which enables the connection manager to forward the originating entity’s identity to the application server. |
java.lang.Short |
getHold()
This attribute informs the client about the maximum number of requests the connection manager will keep waiting at any one time during the session.
|
java.lang.String |
getId()
Gets the session id.
|
java.time.Duration |
getInactivity()
After receiving a response from the connection manager, if none of the client’s requests are still being held by the connection manager (and if the session is not a Polling Session), the client SHOULD make a new request as soon as possible.
|
java.lang.String |
getKey()
Gets the key used to protect insecure connections.
|
java.util.Locale |
getLanguage()
Gets the ‘xml:lang’ attribute.
|
java.time.Duration |
getMaxPause()
If the connection manager supports session pausing (see Inactivity) then it SHOULD advertise that to the client by including a ‘maxpause’ attribute in the session creation response element.
|
java.lang.String |
getNewKey()
Gets the new key used to protect insecure connections.
|
java.time.Duration |
getPause()
If a client encounters an exceptional temporary situation during which it will be unable to send requests to the connection manager for a period of time greater than the maximum inactivity period (e.g., while a runtime environment changes from one web page to another), and if the connection manager included a ‘maxpause’ attribute in its Session Creation Response, then the client MAY request a temporary increase to the maximum inactivity period by including a ‘pause’ attribute in a request.
|
java.time.Duration |
getPolling()
This attribute specifies the shortest allowable polling interval (in seconds).
|
java.lang.Long |
getReport()
After receiving a request with an ‘ack’ value less than the ‘rid’ of the last request that it has already responded to, the connection manager MAY inform the client of the situation by sending its next response immediately instead of waiting until it has payloads to send to the client (e.g., if some time has passed since it responded).
|
java.lang.Short |
getRequests()
This attribute enables the connection manager to limit the number of simultaneous requests the client makes (see Overactivity and Polling Sessions).
|
java.lang.Long |
getRid()
The
<body/> element of every client request MUST possess a sequential request ID encapsulated via the ‘rid’ attribute. |
java.lang.String |
getRoute()
A connection manager MAY be configured to enable sessions with more than one server in different domains.
|
java.lang.String |
getSid()
All requests after the first one MUST include a valid ‘sid’ attribute (provided by the connection manager in the Session Creation Response).
|
java.lang.String |
getStream()
If a connection manager supports the multi-streams feature, it MUST include a ‘stream’ attribute in its Session Creation Response.
|
java.time.Duration |
getTime()
After receiving a request with an ‘ack’ value less than the ‘rid’ of the last request that it has already responded to, the connection manager MAY inform the client of the situation by sending its next response immediately instead of waiting until it has payloads to send to the client (e.g., if some time has passed since it responded).
|
Jid |
getTo()
Gets the ‘to’ attribute.
|
Body.Type |
getType()
The type of the body.
|
java.net.URI |
getUri()
If the connection manager reports a
Body.Condition.SEE_OTHER_URI error condition, this method returns the URI. |
java.lang.String |
getVersion()
Gets the XMPP version.
|
java.time.Duration |
getWait()
This attribute specifies the longest time (in seconds) that the connection manager is allowed to wait before responding to any request during the session.
|
java.util.List<java.lang.Object> |
getWrappedObjects()
Gets an unmodifiable list of wrapped objects.
|
boolean |
isRestart()
If the client requests a stream restart.
|
boolean |
isRestartLogic()
If the connection manager supports stream restarts, it MUST advertise that fact by including a ‘restartlogic’ attribute (qualified by the ‘urn:xmpp:xbosh’ namespace) whose value is set to “true”.
|
java.lang.String |
toString() |
public static final java.lang.String NAMESPACE
public static final java.lang.String XBOSH_NAMESPACE
urn:xmpp:xbosh
public static Body.Builder builder()
Creates a builder for the body element.
public final java.util.List<java.lang.Object> getWrappedObjects()
Gets an unmodifiable list of wrapped objects.
public final java.net.URI getUri()
If the connection manager reports a Body.Condition.SEE_OTHER_URI
error condition, this method returns the URI.
Body.Condition.SEE_OTHER_URI
public final java.lang.String getAccept()
The connection manager MAY include an ‘accept’ attribute in the session creation response element, to specify a comma-separated list of the content encodings it can decompress. After receiving a session creation response with an ‘accept’ attribute, clients MAY include an HTTP Content-Encoding header in subsequent requests (indicating one of the encodings specified in the ‘accept’ attribute) and compress the bodies of the requests accordingly.
public final java.lang.Long getAck()
A client MAY include an ‘ack’ attribute (set to “1”) to indicate that it will be using acknowledgements throughout the session and that the absence of an ‘ack’ attribute in any request is meaningful. When responding to a request that it has been holding, if the connection manager finds it has already received another request with a higher ‘rid’ attribute (typically while it was holding the first request), then it MAY acknowledge the reception to the client. The connection manager MAY set the ‘ack’ attribute of any response to the value of the highest ‘rid’ attribute it has received in the case where it has also received all requests with lower ‘rid’ values.
getReport()
,
getTime()
public final java.lang.String getAuthId()
Gets the ‘authid’ attribute, which contains the value of the XMPP stream ID generated by the XMPP server. This value is needed only by legacy XMPP clients in order to complete digest authentication using the obsolete Non-SASL Authentication (XEP-0078) protocol.
public final java.util.List<java.nio.charset.Charset> getCharsets()
The connection manager MAY inform the client which encodings it can convert by setting the optional ‘charsets’ attribute in the session creation response element to a space-separated list of encodings.
public final Body.Condition getCondition()
Gets a terminal binding condition.
getType()
,
17.2 Terminal Binding Conditionspublic final java.lang.String getContent()
Some clients are constrained to only accept HTTP responses with specific Content-Types (e.g., “text/html”). The <body/>
element of the first request MAY possess a ‘content’ attribute. This specifies the value of the HTTP Content-Type header that MUST appear in all the connection manager’s responses during the session. If the client request does not possess a ‘content’ attribute, then the HTTP Content-Type header of responses MUST be “text/xml; charset=utf-8”.
public final Jid getFrom()
The <body/>
element of the first request MAY also possess a ‘from’ attribute, which specifies the originator of the first stream and which enables the connection manager to forward the originating entity’s identity to the application server.
getFrom
in interface SessionOpen
public final java.lang.Short getHold()
This attribute informs the client about the maximum number of requests the connection manager will keep waiting at any one time during the session. This value MUST NOT be greater than the value specified by the client in the session request. The client SHOULD set the ‘hold’ attribute to a value of “1”.
getRequests()
public final java.time.Duration getInactivity()
After receiving a response from the connection manager, if none of the client’s requests are still being held by the connection manager (and if the session is not a Polling Session), the client SHOULD make a new request as soon as possible. In any case, if no requests are being held, the client MUST make a new request before the maximum inactivity period has expired. The length of this period (in seconds) is specified by the ‘inactivity’ attribute in the session creation response.
getPause()
,
getMaxPause()
,
10. Inactivitypublic final java.lang.String getKey()
Gets the key used to protect insecure connections.
getNewKey()
,
15. Protecting Insecure Sessionspublic final java.time.Duration getMaxPause()
If the connection manager supports session pausing (see Inactivity) then it SHOULD advertise that to the client by including a ‘maxpause’ attribute in the session creation response element. The value of the attribute indicates the maximum length of a temporary session pause (in seconds) that a client can request.
getPause()
,
getInactivity()
public final java.lang.String getNewKey()
Gets the new key used to protect insecure connections.
getKey()
public final java.time.Duration getPause()
If a client encounters an exceptional temporary situation during which it will be unable to send requests to the connection manager for a period of time greater than the maximum inactivity period (e.g., while a runtime environment changes from one web page to another), and if the connection manager included a ‘maxpause’ attribute in its Session Creation Response, then the client MAY request a temporary increase to the maximum inactivity period by including a ‘pause’ attribute in a request.
getMaxPause()
,
getInactivity()
public final java.time.Duration getPolling()
This attribute specifies the shortest allowable polling interval (in seconds). This enables the client to not send empty request elements more often than desired.
public final java.lang.Long getReport()
After receiving a request with an ‘ack’ value less than the ‘rid’ of the last request that it has already responded to, the connection manager MAY inform the client of the situation by sending its next response immediately instead of waiting until it has payloads to send to the client (e.g., if some time has passed since it responded). In this case it SHOULD include a ‘report’ attribute set to one greater than the ‘ack’ attribute it received from the client, and a ‘time’ attribute set to the number of milliseconds since it sent the response associated with the ‘report’ attribute.
Upon reception of a response with ‘report’ and ‘time’ attributes, if the client has still not received the response associated with the request identifier specified by the ‘report’ attribute, then it MAY choose to resend the request associated with the missing response.
public final java.lang.Short getRequests()
This attribute enables the connection manager to limit the number of simultaneous requests the client makes (see Overactivity and Polling Sessions). The RECOMMENDED values are either “2” or one more than the value of the ‘hold’ attribute specified in the session request.
getHold()
public final java.lang.Long getRid()
The <body/>
element of every client request MUST possess a sequential request ID encapsulated via the ‘rid’ attribute.
public final java.lang.String getRoute()
A connection manager MAY be configured to enable sessions with more than one server in different domains. When requesting a session with such a “proxy” connection manager, a client SHOULD include a ‘route’ attribute that specifies the protocol, hostname, and port of the server with which it wants to communicate, formatted as “proto:host:port” (e.g., “xmpp:example.com:9999”).
public final java.lang.String getSid()
All requests after the first one MUST include a valid ‘sid’ attribute (provided by the connection manager in the Session Creation Response). The initialization request is unique in that the <body/>
element MUST NOT possess a ‘sid’ attribute.
public final java.lang.String getId()
Gets the session id.
getId
in interface SessionOpen
getSid()
public final java.lang.String getStream()
If a connection manager supports the multi-streams feature, it MUST include a ‘stream’ attribute in its Session Creation Response. If a client does not receive the ‘stream’ attribute then it MUST assume that the connection manager does not support the feature.
public final java.time.Duration getTime()
After receiving a request with an ‘ack’ value less than the ‘rid’ of the last request that it has already responded to, the connection manager MAY inform the client of the situation by sending its next response immediately instead of waiting until it has payloads to send to the client (e.g., if some time has passed since it responded). In this case it SHOULD include a ‘report’ attribute set to one greater than the ‘ack’ attribute it received from the client, and a ‘time’ attribute set to the number of milliseconds since it sent the response associated with the ‘report’ attribute.
getReport()
,
getAck()
public final Jid getTo()
SessionOpen
Gets the ‘to’ attribute.
getTo
in interface SessionOpen
public final Body.Type getType()
The type of the body.
getCondition()
public final java.lang.String getBoshVersion()
This attribute specifies the highest version of the BOSH protocol that the client supports. The numbering scheme is “<major>.<minor>” (where the minor number MAY be incremented higher than a single digit, so it MUST be treated as a separate integer). Note: The ‘ver’ attribute should not be confused with the version of any protocol being transported.
public final java.time.Duration getWait()
This attribute specifies the longest time (in seconds) that the connection manager is allowed to wait before responding to any request during the session. This enables the client to limit the delay before it discovers any network failure, and to prevent its HTTP/TCP connection from expiring due to inactivity.
public final java.util.Locale getLanguage()
SessionOpen
Gets the ‘xml:lang’ attribute.
getLanguage
in interface SessionOpen
public final java.lang.String getVersion()
Gets the XMPP version.
getVersion
in interface SessionOpen
public final boolean isRestart()
If the client requests a stream restart.
public final boolean isRestartLogic()
If the connection manager supports stream restarts, it MUST advertise that fact by including a ‘restartlogic’ attribute (qualified by the ‘urn:xmpp:xbosh’ namespace) whose value is set to “true”.
public final int compareTo(Body o)
Compares this body with another body by using the request id. Null bodies are sorted last, while null RIDs are sorted first (as it may indicate a session creation request).
compareTo
in interface java.lang.Comparable<Body>
o
- The body.public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.