[undertow-dev] Streaming a ZIP file

Christoph Sturm me at christophsturm.com
Wed Sep 6 03:40:55 EDT 2017


you can send async with exchange.getResponseSender().send(…, callback)

> On 06.09.2017, at 03:38, Hicks, Matt <matt at matthicks.com> wrote:
> 
> Great, thanks! Are there any examples of using an OutputStream with Undertow?
> 
> 
> On Tue, Sep 5, 2017, 4:39 PM Stuart Douglas <sdouglas at redhat.com <mailto:sdouglas at redhat.com>> wrote:
> My bad, I did not read your post properly and was thinking of gzip.
> 
> I think you can still use ZipOutputStream though, it will only be
> blocking if the underlying Stream is blocking, so using something like
> a ByteArrayOutputStream would make the operation non blocking. If you
> want to avoid buffering the whole zip in memory you could potentially
> alternate between writing data to the ZipOutputStream and then taking
> anything written to the ByteArrayOutputStream and flushing it to the
> response channel.
> 
> Stuart
> 
> On Wed, Sep 6, 2017 at 1:31 AM, Hicks, Matt <matt at matthicks.com <mailto:matt at matthicks.com>> wrote:
> > I've looked at DeflatingStreamSinkConduit, but am at a loss to figure out
> > how to adapt this to streaming a zip file.  Is there any other information
> > you could give me?
> >
> > Thanks
> >
> > On Thu, Aug 31, 2017 at 11:46 PM Stuart Douglas <sdouglas at redhat.com <mailto:sdouglas at redhat.com>> wrote:
> >>
> >> You could potentially adapt
> >> io.undertow.conduits.DeflatingStreamSinkConduit, which uses a
> >> java.util.zip.Deflater.
> >>
> >> Stuart
> >>
> >> On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt <matt at matthicks.com <mailto:matt at matthicks.com>> wrote:
> >> > I'm trying to create ZIP files on-demand from the server and stream them
> >> > back to the browser, but I'm not sure the proper way to do this.  The
> >> > only
> >> > way I can think of is to use a `ZipOutputStream`, but that would be a
> >> > blocking operation.  Is there a better way to do this?
> >> >
> >> > _______________________________________________
> >> > undertow-dev mailing list
> >> > undertow-dev at lists.jboss.org <mailto:undertow-dev at lists.jboss.org>
> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev <https://lists.jboss.org/mailman/listinfo/undertow-dev>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170906/df8c6db9/attachment.html 


More information about the undertow-dev mailing list