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 .