Re: setting httpservletresponse output type and content
Gene McCullough <[email protected]> Thu, 22 Dec 2005 23:50:42 -0600
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <[email protected]> |
Just in case a future keeler comes across this, I thought I'd post my solution.
The key is the BinaryWrapper. In the StrutsClientConnector, it checks
for a "type" = binary attribute for the output. If so, it sets the
values, based on the output content being a BinaryWrapper and sends
the response. Here is a code snip from my model:
<snip>
//flush to the client...
//by adding type=binary attribute to the output
Output binreport = res.createOutput("thereport");
binreport.setAttribute("type","binary");
byte mydata[];
BASE64Decoder base64 = new BASE64Decoder();
mydata = base64.decodeBuffer( report.getReportEncoded( "pdf") );
BinaryWrapper bw = new BinaryWrapper();
bw.setContent(mydata);
bw.setContentType("application/pdf");
binreport.setContent( bw );
res.add(binreport);
gene
On 12/12/05, Gene McCullough <[email protected]> wrote:
> in a servlet, I can set the HttpServletResponse content type and
> length, and output directly to the client with a ServletOutputStream.
> Is there any way to get to that functionality from a Keel Model? I
> think that goes against the model input and output methodology, but
> I'm needing to output a mime type to the client so that it recognizes
> and opens the right app.
>
> Thanks in advance,
> --
> Gene McCullough
>
http://keelframework.org/docs/
keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com