Hello!

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 (
https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html)
or DownloadLink (
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/link/DownloadLink.html),
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 -
http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
(it
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