On Aug 17, 2012, at 4:37 PM, dloy <dloy_at_ucop.edu> wrote:
> Sorry, this may have been covered recently but I have not kept up with the list.
>
> My program creates large tar files (e.g. > 15G). I need the output stream to be a direct feed to the user while the tar is being created. Currently I create a tar file and then return the file. The problem is that the delay on the tar creation can be over 1 hour (especially using gz) and often times out - no activity on the connection while the file is being created.
>
> Is there a best practice for doing this?
InputStream, Reader, DataSource, StreamingOutput - those are the types you may want to consider returning from your method. Use of StreamingOutput may be most suitable/convenient for the task.
> How is the mime set?
Depends on the streamed content. You may use any type that matches your content.
> Can a dropped connection be detected?
With streaming output you should get an IO exception when trying to write to the provided output stream.
Marek