> I'm still interested in hear any suggestions. I know that this is not
> strictly an S2 issue but it is related to using a Stream result type. If
> I was writing a servlet I would just get the OutputStream and write directly
> to it, putting the burden of buffering etc. onto the container.
If you want to write directly on the OutputStream you can implement your own
ResultType:
public class ByteContentResult implements Result,StrutsStatics
{
public void execute( ActionInvocation invocation )
throws Exception
{
ByteContentProvider bytesProvider = (ByteContentProvider)
invocation.getAction();
//HttpServletResponse response =
org.apache.struts2.ServletActionContext.getResponse();
HttpServletResponse response =
(HttpServletResponse)invocation.getInvocationContext().get( HTTP_RESPONSE );
response.setContentType(bytesProvider.getContentType());
byte[] content = bytesProvider.getBytes();
response.setContentLength( content.length );
ServletOutputStream outstream = response.getOutputStream();
outstream.write( content );
outstream.flush();
}
}
The action class has only to implement this interface:
public interface ByteContentProvider
{
public String getContentType();
public byte[] getBytes();
}
Then make your result known in your my-struts-default.xml:
<result-types>
<result-type name="bytes" class="result.ByteContentResult"/>
</result-types>
/Stephan
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]