You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Zeit <ze...@googlemail.com> on 2010/05/28 17:12:43 UTC
How to save binary files?
Dear All,
I am a bit confused where the error is: Is it Ubuntu Tomcat configuration or
there is a specific approach to save files from Wicket.
My Application generates several binary files. After files generated I want
to pack them in zip archive and allow user to download them.
Is it possible to do this in Wicket? If so where should I save those files
and how?
Should I get temp filestore folder?
While trying to write files to disk I am getting the following error:
May 28, 2010 10:50:08 AM java.util.prefs.FileSystemPreferences$2 run
WARNING: Couldn't create user preferences directory. User preferences are
unusable.
May 28, 2010 10:50:08 AM java.util.prefs.FileSystemPreferences$2 run
WARNING: java.io.IOException: No such file or directory
Thanks a lot in advance,
Alex
Re: How to save binary files?
Posted by Alex Zeit <ze...@googlemail.com>.
Thank you very much Edward for your help. The solution was to create
temporary directory and place files there:
final File temp = File.createTempFile("temp",
Long.toString(System.nanoTime()));
if (!(temp.delete())) {
throw new IOException("Could not delete temp file: "
+ temp.getAbsolutePath());
}
if (!(temp.mkdir())) {
throw new IOException("Could not create temp directory: "
+ temp.getAbsolutePath());
}
Re: How to save binary files?
Posted by Edward Zarecor <wi...@indeterminate.org>.
This looks like an issue with your Java installation, which you could verify
with a simple standalone test, e.g.,
public static void main(String[] args) { // create file as in Wicket.. }
Ed.
On Fri, May 28, 2010 at 11:12 AM, Alex Zeit <ze...@googlemail.com> wrote:
> Dear All,
> I am a bit confused where the error is: Is it Ubuntu Tomcat configuration
> or
> there is a specific approach to save files from Wicket.
> My Application generates several binary files. After files generated I want
> to pack them in zip archive and allow user to download them.
> Is it possible to do this in Wicket? If so where should I save those files
> and how?
> Should I get temp filestore folder?
> While trying to write files to disk I am getting the following error:
> May 28, 2010 10:50:08 AM java.util.prefs.FileSystemPreferences$2 run
> WARNING: Couldn't create user preferences directory. User preferences are
> unusable.
> May 28, 2010 10:50:08 AM java.util.prefs.FileSystemPreferences$2 run
> WARNING: java.io.IOException: No such file or directory
>
> Thanks a lot in advance,
> Alex
>