public void write ( HttpServletResponse hsr ) throws IOException { PrintWriter xmlResponse = hsr . getWriter ( ) ; xmlResponse . append ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ) ; xmlResponse . append ( "<ows:ExceptionReport xml:lang=\"en-US\" xsi:schemaLocation=\"http://www.opengis.net/ows/1.1" + " http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd\" version=\"2.0.0\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" ) ; xmlResponse . append ( "<ows:Exception " ) ; if ( locator != null ) xmlResponse . append ( "locator=\"" + locator + "\" " ) ; xmlResponse . append ( "exceptionCode=\"" + ExceptionCode + "\">" ) ; xmlResponse . append ( "<ows:ExceptionText>" + text + "</ows:ExceptionText>" ) ; xmlResponse . append ( "</ows:Exception>" ) ; xmlResponse . append ( "</ows:ExceptionReport>" ) ; }
Given the information on construction writes the necessary exception information .