You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Louis Letourneau <lo...@mail.mcgill.ca> on 2008/08/23 04:29:13 UTC

How to stream a file instead of rendering a page?

I need to stream a file to the browser, simple enough...but the file 
might be staged (on tape on a SAN).

In which case I want to display page telling the user to come back, the 
file will be ready in X time.

What I did was mount a QueryStringUrlCodingStrategy in which I overrided 
decode. If the file is available I return a  ResourceStreamRequestTarget 
if it is not I let QueryStringUrlCodingStrategy.decode call the 
notification Page.

I works, but I was curious to know if there is a way to do this from 
within the page without the mount?

If I put RequestCycle.get().setRequestTarget(XXXX) in the constructor, 
it won't work once the page is in the user's session. I can't put it in 
respond() because it's too late in the processing (or is it?).

Any ideas, or the way I did it is the only way.

(I'm still getting my bearings around wicket and I'm trying to find the 
best practices).

Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org