tds/src/main/java/thredds/servlet/ServletUtil.java
public static void returnString(String contents, HttpServletResponse res)
          throws IOException {

    try {
      ServletOutputStream out = res.getOutputStream();
      IO.copy(new ByteArrayInputStream(contents.getBytes(CDM.utf8Charset)), out);
    } catch (IOException e) {
      log.error(" IOException sending string: ", e);
      res.sendError(HttpServletResponse.SC_NOT_FOUND, "Problem sending string: " + e.getMessage());
    }
  }
public static void returnString(String contents, HttpServletResponse res)
          throws IOException {

    try {
      ServletOutputStream out = res.getOutputStream();
      IO.copy(new ByteArrayInputStream(contents.getBytes(CDM.utf8Charset)), out);
    } catch (IOException e) {
      log.error(" IOException sending string: ", e);
      res.sendError(HttpServletResponse.SC_NOT_FOUND, "Problem sending string: " + e.getMessage());
    }
  }
public static void returnString ( String contents , HttpServletResponse res ) throws IOException { try { ServletOutputStream out = res . getOutputStream ( ) ; IO . copy ( new ByteArrayInputStream ( contents . getBytes ( CDM . utf8Charset ) ) , out ) ; } catch ( IOException e ) { log . error ( " IOException sending string: " , e ) ; res . sendError ( HttpServletResponse . SC_NOT_FOUND , "Problem sending string: " + e . getMessage ( ) ) ; } }
Send given content string as the HTTP response.

@param contents the string to return as the HTTP response.
@param res      the HttpServletResponse
@throws IOException if an I/O error occurs while writing the response.
Send given content string as the HTTP response .