404 - Request was not handled by any registered handler

When using a com.vaadin.ui.Link to a resource and the Link’s name has UTF-8 multibyte characters I get the above 404 when handling the link. The same link and resource work fine when there are no multibyte characters. I believe it probably has something to do with the URL generated by Vaadin. Is this a bug, or is there something I can do to work around?

This is the generated URL:


Upon further investigation it appears the problem occurs when passing multibyte characters to the second argument of the StreamResource constructor for the filename. For example, the following causes the problem:

北京是具有悠久历史文化.xls

Are there any restrictions on the filenames that may be used with StreamResource? I have not read any. Are there any known bugs?

I’ve answered my own question. The issue is that the filename needs to be URLEncoded if it may contain non-ascii characters. This needs to be more clear in the javadocs in my opinion. For those running into the same problem:

URLEncoder.encode(getFilename(),“utf-8”)