Return new ResponseEntity(isr, respHeaders, HttpStatus.OK) īelow code worked for me to generate and download a text file. Example: InputStreamResource isr = new InputStreamResource(new FileInputStream(file)) Our technology’s main advantage is its high compression rate. We turn various online contents (such as Wikipedia, for example) into ZIM files, and these can be opened by Kiwix even if you have no connectivity. you pick the data up from the DB, you should use InputStreamResource. Kiwix is an offline reader meaning that it allows you to browse text or video that is normally only available on the internet. Slow scenarios include: if the file is very large, specially if it is on a remote system or something more elaborated like that - a database, maybe. In very specific scenarios, though, it can be slow, in which case you should have it stored previously (e.g. To obtain such value, know that File#length() should be good enough in the general case, so it is a safe default choice. Still, if you can provide a value, it is better. More on setContentLength(): First of all, the content-length header is optional per the HTTP 1.1 RFC. New FileSystemResource(file), respHeaders, HttpStatus.OK tContentDispositionFormData("attachment", "fileNameIwant.pdf") zim files that will open directly inside Kiwix without requiring any conversion. You need to install the Kiwix software on your computer and then download one of the Wikipedia editions the articles are packaged as. HttpHeaders respHeaders = new HttpHeaders() A good alternative to WikiTaxi is Kiwix this is also free software and available for Mac, Windows and Linux systems. Long fileLength = file.length() // this is ok, but see note below String fullPath = stuffService.figureOutFileNameFor(stuffId) If the return value of your pdf framework is an byte array (read the second part of my answer for other return values) : = "/files/", method = RequestMethod.GET) Download Kiwix Reader Installation of the Windows client. If you use this, then your controller does not need a HttpServletResponse object, and therefore it is easier to test.Įxcept this, this answer is relative equals to the one of Infeligo. 2 Download 2.1 Downloading Kiwix Players To read EduTechWiki offline you must first install a reader Kiwix, available for Windows, MacOSX, Linux, Android and iOS. With Spring 3.0 you can use the HttpEntity return object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |