On Tue, Feb 19, 2013 at 11:14 AM, Martin Dietze <[email protected]> wrote:
> On Tue, February 19, 2013, Martin Grigorov wrote: > > > You can use requestCycle.replaceAllRequestHandlers(new > > ResourceRequestHandler(new ByteArrayResource(byteArray))) in your page > code. > > This will stop the page rendering and will return the byte[] from this > > response. You can still configure the ByteArrayResource - filename, > > disposition, etc. > > Thank you, I tried this (slightly corrected version): > > | RequestCycle.get().replaceAllRequestHandlers( new > ResourceRequestHandler( new ByteArrayResource( mimeType, byteArray ), null > ) ); > > But this triggers a ReplaceHandlerException at > RequestHandlerStack.replaceAll() as at that time > RequestHandlerStack.requestHandlers is not empty. > This is how it works. #replaceAllRequestHandlers() throws an exception to stop doing whatever it does at the moment. #scheduleRequestHandlerAfterCurrent() just appends a new RH to the list and executes it when all previous are executed. Since there is no need to wait for any other scheduled I think you can use #replaceAllRHs(). What is the problem ? > > This actually looks weird to me as I'd expect a > 'replaceAll' method to replace what is already > there. Maybe a bug here? > > Cheers, > > M'bert > > -- > ----------- / http://herbert.the-little-red-haired-girl.org / > ------------- > =+= > No violence, gentlemen -- no violence, I beg of you! Consider the > furniture! > -- Sherlock Holmes > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
