users@jersey.java.net

Re: [Jersey] return type of file download ??

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 07 Sep 2009 20:00:45 +0200

On Sep 7, 2009, at 7:41 PM, Felipe Gaúcho wrote:

> I am coding a method to transfer a file contents between the service
> and the client.. what is the method return type ? OutputStream ?
> byte[] ?

You can return an instance of InputStream.

Or you can return an instance of StreamingOutput:

   https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/StreamingOutput.html


I recently came across this for zip files:

   http://zcox.wordpress.com/2009/08/26/dynamically-generating-zip-files-in-jersey/

Paul.

> Jersey has support for stax ?
>
> @GET
> @Path("{acronym}/file")
> @Produces("what??")
> public byte[] downloadAttachment() {
> // something here
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>