I assume that you're talking about a Struts 2 portlet since you're
saying "within a portal"? If not, just disregard my response.

A (jsr168)portlet can't render binary content (some jsr168 portlet
containers have proprietary extensions to do this, but it's not
supported by the framework), so you need to access your image
rendering action as a regular Struts 2 servlet application. The
easiest way to do this is to create a new package in struts.xml that
extends struts-default and put your action there. Then create the url
to the image "manually" (use the "value" attribute of the url tag, or
just create it by hand). You also need the FilterDispatcher in the
web.xml file if it's not there already.

This also means that if you're sharing session values between the
actions in the portlet and the actions creating the image, you have to
put them in the application scope of the portlet session.

Luckily, this is directly supported in the new portlet 2.0 secification.

Nils-H

On Tue, Mar 11, 2008 at 9:52 PM, Euphreme Rinfrett
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
>     I'm trying to use to "stream" result type to get some images to
>  display within a portal.
>
>  Based on the wiki page: http://struts.apache.org/2.x/docs/stream-result.html
>
>  I did my own action that gets an image and puts it into a model.
>
>  This is the struts configuration:
>
>         <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.
>
>  While getting called, I'm getting the following error:
>  NoSuchMethodException: setBufferSize(java.lang.String)
>
>  My first though was that the image was null, but it's not the case, the
>  size should be 12345.
>
>  Any clue ?
>
>  Thanks,
>  - Pascal
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to