I subclassed DynamicWebRessource, but I still have the problem that I do not 
know how to add the RessourceState to my WebResponse for my download link.
I found the class ResourceReference but no I did not find out how to use it. 
 
Do I have to use the ResourceReferece Class or is there another way to get my 
download working?
 
Perhaps you could give me a short example
 
Thanks
Robert

 
________________________________

Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Philip A. 
Chapman
Gesendet: Mittwoch, 03. Jänner 2007 12:03
An: wicket-user@lists.sourceforge.net
Betreff: Re: [Wicket-user] Writing byte[] to a WebResponse


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
-------------------------------------------------------------------------
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