@RequestMapping(value = "/network.xml", method = RequestMethod.GET) public void exportToXml(HttpServletRequest request, HttpServletResponse response) throws Exception { DistributionNetwork network = distributionNetworkRepository.read(); response.setContentType("application/xml"); SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy"); String file = "risk-analyzer-network-export-" + dateFormat.format(new Date()) + ".xml"; response.setHeader("Content-Disposition", "attachment;filename=" + file); networkMarshaller.marshall(network, response.getOutputStream()); }
@RequestMapping(value = "/network", method = RequestMethod.GET) public @ResponseBody DistributionNetwork getNetwork() throws Exception { return distributionNetworkRepository.read(); }