You need to do two steps to download a file from java restful web services.
- Annotate your service method with @Produces annotation. This annotation should have the file MIME type as a value. For example, if you are downloading pdf file then MIME type should be "application/pdf", in case if you are downloading png image file, then MIME type should be "image/png".
 - In the Response header, set “Content-Disposition” details, which helps to prompt download box on browser.
 
Here is the service class to download file:
Hello, Iᡉm Dhananjaya Naidu Reddi, a passionate Java Developer based in the vibrant city of Bangalore, India. Like many of you visiting, I have a deep appreciation for Java and the art of software development. I have extensive experience as a Java/J2EE Full Stack developer, proficient in a wide range of technology frameworks and cloud technologies.
0 comments:
Post a Comment