Package org.igniterealtime.jbosh
Class BodyParserXmlPull
java.lang.Object
org.igniterealtime.jbosh.BodyParserXmlPull
- All Implemented Interfaces:
BodyParser
Implementation of the BodyParser interface which uses the XmlPullParser
API. When available, this API provides an order of magnitude performance
improvement over the default SAX parser implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Logger
Logger.private static final ThreadLocal
<SoftReference<org.xmlpull.v1.XmlPullParser>> Thread local to contain a XmlPullParser instance for each thread that attempts to use one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.xmlpull.v1.XmlPullParser
Gets a XmlPullParser for use in parsing incoming messages.Parses the XML message, extracting the useful data from the initial body element and returning it in a results object.
-
Field Details
-
LOG
Logger. -
XPP_PARSER
Thread local to contain a XmlPullParser instance for each thread that attempts to use one. This allows us to gain an order of magnitude of performance as a result of not constructing parsers for each invocation while retaining thread safety.
-
-
Constructor Details
-
BodyParserXmlPull
BodyParserXmlPull()
-
-
Method Details
-
parse
Parses the XML message, extracting the useful data from the initial body element and returning it in a results object.- Specified by:
parse
in interfaceBodyParser
- Parameters:
xml
- XML to parse- Returns:
- useful data parsed out of the XML
- Throws:
BOSHException
- on parse error
-
getXmlPullParser
private static org.xmlpull.v1.XmlPullParser getXmlPullParser()Gets a XmlPullParser for use in parsing incoming messages.- Returns:
- parser instance
-