_buffer.put(END_PACKET);
_buffer.put(AJP13_END_RESPONSE);
    private void prepareBuffers()    {        if (!_bufferPrepared)        {            // Refill buffer if possible            if (_content != null && _content.length() > 0 && _buffer != null && _buffer.space() > 0)            {                int len = _buffer.put(_content);                                // TODO HORRID HACK!                if (len>0)                {                    len--;                    _buffer.setPutIndex(_buffer.putIndex()-1);                    _content.setGetIndex(_buffer.getIndex()-1);                }                _content.skip(len);                if (_content.length() == 0)                     _content = null;            }                                    // add header if needed            if (_buffer!=null)            {                int payloadSize=_buffer.length();                                // 4 bytes for the ajp header                // 1 byte for response type                // 2 bytes for the response size                // 1 byte because we count from zero??                if (payloadSize>0)                {                    _bufferPrepared=true;                    _buffer.put((byte)0);                    int put=_buffer.putIndex();                    _buffer.setGetIndex(0);                    _buffer.setPutIndex(0);                    _buffer.put((byte)'A');                    _buffer.put((byte)'B');                    addInt(payloadSize+4);                    _buffer.put((byte)3);                    addInt(payloadSize);                    _buffer.setPutIndex(put);                }            }                    if (_needEOC)            {                if (_buffer == null && _header.space() >= END_PACKET.length)                {                    _header.put(END_PACKET);                    _needEOC = false;                }                else if (_buffer!=null && _buffer.space()>=END_PACKET.length)                {                    // send closing packet if all contents are added                    _buffer.put(END_PACKET);                    _needEOC=false;                    _bufferPrepared=true;                }            }        }    }