I have an AbstractResource modelled after section 15.9 in the Wicket Guide:
http://wicket.apache.org/guide/guide/resources.html

What is the correct way to handle errors (such as expected dynamic data not
available) during the writeCallback?

The specific line in the example is: output.output(getFeed(), writer);


While I throw a WicketRuntimeException during the writeCallback and the
server aborts the request and logs the error, the client sits waiting for
the download. Worse still, after the client times out (Chrome on OS X), the
downloads bar displays what looks like a successfully downloaded valid file
with no indication of error, and while it does have some data in it (in my
case around 4800 bytes) its not valid (Im a little puzzled about the ~4800
bytes or so). Ideally I'd like to give the user a notification that the
download failed.

If I try and get the data before the writecallback, and then set the
ErrorCode on the ResourceResponse when the data is not available, the user
is redirected to an unstyled Jetty served error screen which we don't want
to see - we'd rather signal that the download failed and keep the user on
the same page.  Is this possible with ResourceLink/AbstractResource or do
we have to use an alternative method to make this work more elegantly?

Reply via email to