private void sendError(HttpSession session, AsyncContext context, BoshBindingError bindingError)
            throws IOException
    {
        if (HttpBindManager.LOG_HTTPBIND_ENABLED.getValue()) {
            Log.info("HTTP ERR(" + session.getStreamID().getID() + "): " + bindingError.getErrorType().getType() + ", " + bindingError.getCondition() + ".");
        }
        try {
            if ((session.getMajorVersion() == 1 && session.getMinorVersion() >= 6) || session.getMajorVersion() > 1)
            {
                final String errorBody = createErrorBody(bindingError.getErrorType().getType(), bindingError.getCondition());
                respond(session, context, errorBody, true);
            } else {
                sendLegacyError(context, bindingError);
            }
        }
        finally {
            if (bindingError.getErrorType() == BoshBindingError.Type.terminate) {
                Log.debug( "Closing session due to error: {}. Affected session: {}", bindingError, session );
                session.close();
            }
        }
    }
Servlet which handles requests to the HTTP binding service. It determines if there is currently
an {@link HttpSession} related to the connection or if one needs to be created and then passes it
off to the {@link HttpBindManager} for processing of the client request and formulating of the
response.

@author Alexander Wenckus
xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpBindServlet.java