@ SuppressWarnings ( "deprecation" ) @ RequestMapping ( value = "/api/backup" , method = RequestMethod . GET ) public @ ResponseBody String getBackup ( Model model , HttpServletResponse response ) throws Exception { response . addHeader ( "Content-Disposition" , "attachment; filename=backup.json" ) ; response . setContentType ( "application/json" ) ; Backup backup = BackupService . getInstance ( ) . getBackupData ( ) ; ObjectMapper objectMapper = new ObjectMapper ( ) ; ObjectWriter writer = objectMapper . writerWithDefaultPrettyPrinter ( ) ; return writer . withView ( ViewFilters . Default . class ) . writeValueAsString ( backup ) ; }
Get all backup data