Faced an interesting problem, however few hours of googling and trial did
not lead to success. wicket is 1.4

The problem: I have an AjaxDownload (
or DownloadLink (
both very good and cool components. Thank you the developers! I am
streaming a dynamically-generated content to the user and want them to save
it as a file. Usual implementation of both is coming down
to ResourceStreamRequestTarget, which in turn does the actual streaming and
also sets the content-disposition: attachment; filename=''.

And here the trouble starts. If we have, say, cyrillic names of the files
to present to user, they are displayed incorrectly in browser. ASCII is
okay, but as soon as it comes down to non-english, encoding is broken.
That's a good article describing problem in general -
is a problem of browsers, and not Wicket). The good solution seen there is
to add content-disposition header without a filename, and make download
happen off the URL which is ending in the desired filename.

Now, the question - how do i do it in wicket? Say, I have an AjaxLink
within page, which has an AjaxDownload attached to it. AjaxDownload is an
anonymous inner class and is using some page's model to generate its data.
The callback URL of this behavior is standard and is starting with ?, e.g.
I can not add /filename.ext prior to it, it would break wicket's request
target location with 404 as a result.

The only idea I have at the moment is to mount the page with a Hybrid
coding strategy, thus the filename would then be considered just as one of
the parameters by the page, but the solution seems to be a little smelly.

Did anyone face the same problem?

Great thanks and appreciation in advance!

with kindest regards,

Alexander Cherednichenko
[ the only way out is the way up ]

Reply via email to