Return a file using Java Jersey

前端 未结 4 1123
孤城傲影
孤城傲影 2020-12-28 16:07

I am using the Java Jersey to implement a REST service. One thing my service should provide is a file download option. These files are quite big and are constructed from dat

4条回答
  •  渐次进展
    2020-12-28 17:06

    depends on the type of underlying database connection/driver, if you have access to the JDBC layer (e.g. using Hibernate) it should be possible to stream data using the JDBC Streaming API, then take the Streams from the ResultSet and pass them into Jersey's Response Builder. I have not done this myself though..

    check here:

    • JDBC's getBinaryStream()

    • An example

提交回复
热议问题