code: private void sendResponse(HttpServletResponse servletResponse, RESTResponse restResponse) throws IOException {
          servletResponse.setStatus(restResponse.getCode().getCode());
          
          Map<String, String> responseHeaders = restResponse.getHeaders();
          if (responseHeaders != null) {
              for (Map.Entry<String, String> mapEntry : responseHeaders.entrySet()) {
                  if (mapEntry.getKey().equalsIgnoreCase(HttpDefs.CONTENT_TYPE)) {
                      servletResponse.setContentType(mapEntry.getValue());
                  } else {
                      servletResponse.setHeader(mapEntry.getKey(), mapEntry.getValue());
                  }
              }
          }
          
          byte[] bodyBytes = restResponse.getBodyBytes();
          int bodyLen = bodyBytes == null ? 0 : bodyBytes.length;
          servletResponse.setContentLength(bodyLen);
          
          if (bodyLen > 0 && servletResponse.getContentType() == null) {
              servletResponse.setContentType("text/plain");
          }
          
          if (bodyLen > 0) {
              servletResponse.getOutputStream().write(restResponse.getBodyBytes());
          }
      }
docs: the Content-Length and a Content-Type of Text/plain.