JBIDE-15430 - Chrome regression because of invalid content-lenght returned with special characters

Fixed the way the returned entity is written into the response outputstream
added a junit test to verify that the 'Content-Length' response header matches the actual response body (in byte[])