The reason you're getting errors in MS Word is that you're converting a
byte array into a String using ByteArrayOutputStream's toString()
method.  A Java String and a byte array are not always the same thing
due to unicode.

Subclass wicket.markup.html.DynamicWebResource so that it returns the
correct instance of ResourceState (also your own implementation).  Among
other things, ResourceState is supposed to provide a byte array that is
the content of the download.  This would be the byte array from your
database.

On Wed, 2007-01-03 at 11:37 +0100, Thullner, Robert wrote:

> Hello
> 
> I store a lot of MS Word and Excel files as a byte[] into my
> database. 
> I want to add a feature to download these files from the database
> again, but I did not find a way to do this in Wicket, without writing
> the byte[] to a File again.
> 
> Is there a way to write a byte[] to a WebResponse? I tried the same
> Code, which is available at the Export Example from Wicket
> 
> I got my byte[] from the database and then wrote it to a
> ByteArrayOutputStream.Then I used the toString() method. But if I
> download the file then I get a lot of conversion errors from MS Word,
> so I would like to write the byte[] directly. 
> 
> So I tried this method: response.getOutputStream().write(file); 
> But using this I get this error:
> java.lang.UnsupportedOperationException: Cannot get output stream on
> BufferedResponse
> 
> Thanks for any help 
> Robert
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________ Wicket-user mailing list 
> Wicket-user@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/wicket-user

-- 
Philip A. Chapman

Desktop and Web Application Development:
Java, .NET, PostgreSQL, MySQL, MSSQL
Linux, Windows 2000, Windows XP

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to