Send output incrementally in StreamHandlerImp.

* Use a generic output function to accumulate data.
* Chunk content output if necessary.
* Clean JSONRPC and remove unused code.
Use better base64 handling in ServerHandlerImp.