/** * Responds to the HTTP request with exception. NOTE: Currently, only application/xml content type * is supported. */ private void _responseWithException( final Exception ex, final HttpStatus http_status, final HttpServletResponse response) { _LOG_.error("response with exception: " + ex.getClass().getName() + " - " + ex.getMessage()); response.setContentType(MediaType.APPLICATION_XML.toString()); response.setStatus(http_status.value()); Writer writer = null; try { writer = response.getWriter(); _getNvdXmlMapper().marshal(ex, writer); } catch (IOException io_ex) { _LOG_.error("ERROR in exception handling: " + io_ex); } finally { if (writer != null) { try { writer.flush(); writer.close(); } catch (Exception ig_ex) { _LOG_.warn("ERROR in exception handling: " + ig_ex); } } } }