If you have the zip file in RAM you can construct a
ByteArrayInputStream();
something like this:
byte a[]= "foo".getBytes();
ByteArrayInputStream i = new ByteArrayInputStream(a);
return new StreamingResolution("application/zip", i);
If the file is static and stored within the web app, you may just be
able to make a ForwardResolution() assuming the mime type is mapped.
The documentation provides a nice example showing to really stream the
content using an inner class:
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/StreamingResolution.html
return new StreamingResolution("text/xml") {
public void stream(HttpServletResponse response) throws Exception {
response.getOutputStream().write(...);
}
}.setFilename("your-filename.xml");
In this case, you can write the bytes of the zip file using:
response.getOutputStream().write(...);
On Aug 24, 2009, at 2:11 PM, Laurent Perez wrote:
Hi
I need to serve a zip file directly from a returning Resolution
(redirecting to the generated zip file is not an option).
The zip file is not big, a few KB.
I've played with the StreamingResolution, but I still can't manage to
get it right : the content type is of course "application/zip", but
what's the best option for the second argument : should I be using an
InputStream or a Reader ?
Thanks for any input
:)
laurent
--
<a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
- Mobile world, technology and more</a>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day
trial. Simplify your report design, integration and deployment - and
focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users