public abstract class AbstractIQ extends Stanza
<iq/> stanza.
Info/Query, or IQ, is a "request-response" mechanism, similar in some ways to the Hypertext Transfer Protocol [HTTP]. The semantics of IQ enable an entity to make a request of, and receive a response from, another entity. The data content of the request and response is defined by the schema or other structural definition associated with the XML namespace that qualifies the direct child element of the IQ element (see Section 8.4), and the interaction is tracked by the requesting entity through use of the 'id' attribute. Thus, IQ interactions follow a common pattern of structured data exchange such as get/result or set/result (although an error can be returned in reply to a request if appropriate)
To enforce these semantics, the following rules apply:
- The 'id' attribute is REQUIRED for IQ stanzas.
- The 'type' attribute is REQUIRED for IQ stanzas. The value MUST be one of the following; if not, the recipient or an intermediate router MUST return a
<bad-request/>stanza error (Section 8.3.3.1).
- get -- The stanza requests information, inquires about what data is needed in order to complete further operations, etc.
- set -- The stanza provides data that is needed for an operation to be completed, sets new values, replaces existing values, etc.
- result -- The stanza is a response to a successful get or set request.
- error -- The stanza reports an error that has occurred regarding processing or delivery of a get or set request (see Section 8.3).
- An entity that receives an IQ request of type "get" or "set" MUST reply with an IQ response of type "result" or "error". The response MUST preserve the 'id' attribute of the request (or be empty if the generated stanza did not include an 'id' attribute).
- An entity that receives a stanza of type "result" or "error" MUST NOT respond to the stanza by sending a further IQ response of type "result" or "error"; however, the requesting entity MAY send another request (e.g., an IQ of type "set" to provide obligatory information discovered through a get/result pair).
- An IQ stanza of type "get" or "set" MUST contain exactly one child element, which specifies the semantics of the particular request.
- An IQ stanza of type "result" MUST include zero or one child elements.
- An IQ stanza of type "error" MAY include the child element contained in the associated "get" or "set" and MUST include an
<error/>child.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractIQ.Type
Represents a
<iq/> 'type' attribute. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getExtension(Class<T> type)
Gets an extension by type.
|
AbstractIQ.Type |
getType()
Gets the type.
|
boolean |
isRequest()
Returns if this is a request IQ, i.e. of type get or set.
|
boolean |
isResponse()
Returns true, if this IQ is a response (either a positive result or an error).
|
void |
setExtension(Object extension)
Deprecated.
Use constructor.
|
String |
toString() |
createError, createError, getError, getFrom, getId, getLanguage, getTo, setError, setFrom, setId, setLanguage, setTo, withFrompublic final AbstractIQ.Type getType()
public final <T> T getExtension(Class<T> type)
StanzagetExtension in class StanzaT - The type.type - The class.@Deprecated public final void setExtension(Object extension)
extension - The extension.public final boolean isRequest()
public final boolean isResponse()
Copyright © 2014–2015 XMPP.rocks. All rights reserved.