struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Euphreme Rinfrett <euphreme_rinfr...@yahoo.ca>
Subject Re: [Bulk] Re: [struts] "stream" result type
Date Tue, 11 Mar 2008 21:59:21 GMT
Excellent, this is great and made everything work.

Thank you very much for the quick response.

- Pascal

Dale Newfield wrote:
> Euphreme Rinfrett wrote:
>>    I'm trying to use to "stream" result type to get some images to 
>> display within a portal.
>
>>        <action name="displayExerciceImageAction" 
>> class="displayExerciceAction">
>>            <result name="success" type="stream">
>>              <param name="contentType">${model.imageContentType}</param>
>>              <param name="inputName">${model.image}</param>
>>              <param 
>> name="contentDisposition">filename="${model.name}_img"</param>
>>              <param name="bufferSize">${model.image.length}</param>
>>            </result>
>>        </action>
>
>> image being an array of bytes.
>
> You've got a mixup between "contentLength" and "bufferSize"
> bufferSize is simply the size chunks sent out along the wire 
> (something simple like 1024 or 2048), "contentLength" is the size of 
> the image you're trying to send.  (And if you don't provide it, your 
> content will be fetched twice, once to find the size, again to send it.)
> your "contentDisposition" is invalid (as is the example you reference, 
> BTW).  You want that to read inline;filename="${model.name}_img". 
> Lastly, you've got the actual content wrong.  "inputName" does not 
> accept OGNL, but rather a property name on your action for which there 
> should be a getter that returns an InputStream (not an array of bytes, 
> and not the same InputStream each time it's called but rather a new 
> one each time).
>
> Here's an example from my current app:
>
> <result name="success" type="stream">
>   <param name="contentType">${media.mimetype}</param>
>   <param name="inputName">mediaFileStream</param>
>   <param 
> name="contentDisposition">inline;filename="${media.code}.${media.suffix}"</param>

>
>   <param name="bufferSize">1024</param>
>   <param name="contentLength">${mediaFileLength}</param>
> </result>
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message