java - How to download a CSV file stored in server at location Temp/hello.csv -
i want download csv file @ server on location temp\hello.csv using java code
- i have data. populating data csv file, hello.csv
- this file saving/storing in server under \temp folder
- the csv file gets stored @ location temp\hello.csv folder in server.
- i want download file don't know how using java code
this should work (from https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-async-output-stream):
@requestmapping("/download") public streamingresponsebody handle() { return new streamingresponsebody() { @override public void writeto(outputstream outputstream) throws ioexception { file file=new file("temp\hello.csv"); fileinputstream stream =new fileinputstream(file); ioutils.copy(stream, outputstream); } }; }
but there many other capabilities. (spring boot service download file , downloading file spring controllers , ...)
Comments
Post a Comment