这是我从 wicket 示例网站做的下载链接。我想通过让用户选择应该保存文件的目录来改变它。有什么方法可以实现吗?提前致谢
add(new DownloadLink("generate_report", new AbstractReadOnlyModel<File>()
{
private static final long serialVersionUID = 1L;
@Override
public File getObject()
{
File tempFile;
try
{
tempFile = File.createTempFile("wicket-examples-download-link--", ".tmp");
InputStream data = new ByteArrayInputStream("some data".getBytes());
Files.writeTo(tempFile, data);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
return tempFile;
}
}).setCacheDuration(Duration.NONE).setDeleteAfterDownload(true));