public void deliverBody(@Nullable final String body, final boolean async) throws HttpConnectionClosedException, IOException
    {
        if (session == null) {
            // This indicates that there's an implementation error in Openfire.
            throw new IllegalStateException("Cannot be used before bound to a session.");
        }

        // We only want to use this function once so we will close it when the body is delivered.
        synchronized (this) {
            if (isClosed) {
                throw new HttpConnectionClosedException("The http connection is no longer " +
                        "available to deliver content");
            }
            isClosed = true;
        }

        HttpBindServlet.respond(getSession(), this.context, body != null ? body : session.createEmptyBody(false), async);
    }
Delivers content to the client. The content should be valid XMPP wrapped inside of a body.
A <i>null</i> value for body indicates that the connection should be closed and the client
sent an empty body.

@param body the XMPP content to be forwarded to the client inside of a body tag.
@param async when false, this method blocks until the data has been delivered to the client.

@throws HttpConnectionClosedException when this connection to the client has already received
a deliverable to forward to the client
@throws IOException if an input or output exception occurred
xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpConnection.java