code: private static void writeTextToResponse(final HttpServletResponse res, final String text) throws IOException {
  		res.setCharacterEncoding(UTF_8);
  		res.setContentType(TEXT_X_JSON);
  		PrintWriter writer = res.getWriter();
  		writer.write(text);
  		writer.flush();
  	}
docs: Writes specified text to response and flushes the stream.
  
  @param res
  {@link HttpServletRequest}
  @param text
  {@link String}
  @throws java.io.IOException
  if an input or output exception occurred