Re: [Wicket-user] Writing byte[] to a WebResponse

2007-05-08 Thread JulianS


Janos Cserep wrote:
> 
> 4. modify getContentType() and getData() to return your objects (you can
> get
> any HTTP parameter with the getParameter() call of the Resource class in
> getData() so you could pass arguments to theURL like
> http://server/context/.../my/resource/url?id=XkdfG12
> 

It took me a while to discover that (at least for Wicket 1.2.5) the correct
form of the URL is:

http://server/context/.../my/resource/url/id/XkdfG12

Otherwise, the ValueMap will be empty.
-- 
View this message in context: 
http://www.nabble.com/Writing-byte---to-a-WebResponse-tf2912722.html#a10381309
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Igor Vaynberg

yes, that is an added bonus. wicket urls are not hijackable because they are
always session-relative

-igor


On 1/3/07, Korbinian Bachl <[EMAIL PROTECTED]> wrote:


 Isn't it in this case also a "free" download protection inside? - as the
URL only is valid for this session so your download cant be "stolen" by
anyone else by pointing a URL from his site to a server.

unbelievable how much you get with just using wicket for "free"

 --
*Von:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *Im Auftrag von *Igor Vaynberg
*Gesendet:* Mittwoch, 3. Januar 2007 18:13
*An:* wicket-user@lists.sourceforge.net
*Betreff:* Re: [Wicket-user] Writing byte[] to a WebResponse

or even easier (if you dont need a bookmarkable url)

abstract class ByteArrayLink extends Link {

protected abstract byte[] getbytes();
protected abstract String getfilename();

public void onclick() {
getRequestCycle().setRequestTarget(new IRequestTarget() {
   void detach(RequestCycle rc) {}
   Object getLock(RequestCycle rc) { return ByteArrayLink.this; }
   void respond(RequestCycle rc) {
WebResponse r = (WebResponse)requestCycle.getResponse();
r.setAttachmentHeader(getfilename());
response.getOuptutStream().write(getbytes());
}}
}


-igor


On 1/3/07, Janos Cserep <[EMAIL PROTECTED]> wrote:
>
> Very short, very quick DynamicWebResource tutorial:)
>
> 1. Subclass DynamicWebResource
>
> public class MyResource extends DynamicWebResource {
>
> @Override
> protected DynamicWebResource.ResourceState getResourceState() {
>
>   return new ResourceState() {
>
> public byte[] getData() {
>   return "Example".toBytes("UTF-8");
> }
>
> public String getContentType() {
>   return "text/plain";
> }
>};
> }
> }
>
> 2. Open your Application class and append your init() method with the
> following two lines:
>
> getSharedResources().add("myResource", new MyResource( );
> mountSharedResource("/my/resource/url", new
> ResourceReference("myResource").getSharedResourceKey());
>
> 3. Browse to the http://server/context/.../my/resource/url URL and it
> should show the "Example" string
>
> 4. modify getContentType() and getData() to return your objects (you can
> get any HTTP parameter with the getParameter() call of the Resource class in
> getData() so you could pass arguments to theURL like
> http://server/context/.../my/resource/url?id=XkdfG12
>
>
> Janos
>
>
> -
> 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
>
>
>

-
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



-
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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Korbinian Bachl
Isn't it in this case also a "free" download protection inside? - as the URL
only is valid for this session so your download cant be "stolen" by
anyone else by pointing a URL from his site to a server.
 
unbelievable how much you get with just using wicket for "free"


  _  

Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Igor
Vaynberg
Gesendet: Mittwoch, 3. Januar 2007 18:13
An: wicket-user@lists.sourceforge.net
Betreff: Re: [Wicket-user] Writing byte[] to a WebResponse


or even easier (if you dont need a bookmarkable url)

abstract class ByteArrayLink extends Link {

protected abstract byte[] getbytes();
protected abstract String getfilename();

public void onclick() { 
getRequestCycle().setRequestTarget(new IRequestTarget() {
   void detach(RequestCycle rc) {}
   Object getLock(RequestCycle rc) { return ByteArrayLink.this; }
   void respond(RequestCycle rc) {
WebResponse r = (WebResponse)requestCycle.getResponse(); 
r.setAttachmentHeader(getfilename());
response.getOuptutStream().write(getbytes());
}}
}

  
-igor



On 1/3/07, Janos Cserep <[EMAIL PROTECTED]> wrote: 

Very short, very quick DynamicWebResource tutorial:)

1. Subclass DynamicWebResource

public class MyResource extends DynamicWebResource { 

@Override
protected DynamicWebResource.ResourceState getResourceState() { 

  return new ResourceState() { 

public byte[] getData() { 
  return "Example".toBytes("UTF-8"); 
} 

public String getContentType() { 
  return "text/plain"; 
} 
   }; 
} 
}

2. Open your Application class and append your init() method with the
following two lines:

getSharedResources().add("myResource", new MyResource( ); 
mountSharedResource("/my/resource/url", new
ResourceReference("myResource").getSharedResourceKey()); 

3. Browse to the http://server/context/.../my/resource/url URL and it should
show the "Example" string 

4. modify getContentType() and getData() to return your objects (you can get
any HTTP parameter with the getParameter() call of the Resource class in
getData() so you could pass arguments to theURL like
http://server/context/.../my/resource/url?id=XkdfG12


Janos 

-
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
<http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
&p=sourceforge&CID=DEVDEV

___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
<https://lists.sourceforge.net/lists/listinfo/wicket-user> 





-
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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Igor Vaynberg

or even easier (if you dont need a bookmarkable url)

abstract class ByteArrayLink extends Link {

protected abstract byte[] getbytes();
protected abstract String getfilename();

public void onclick() {
getRequestCycle().setRequestTarget(new IRequestTarget() {
  void detach(RequestCycle rc) {}
  Object getLock(RequestCycle rc) { return ByteArrayLink.this; }
  void respond(RequestCycle rc) {
   WebResponse r = (WebResponse)requestCycle.getResponse();
   r.setAttachmentHeader(getfilename());
   response.getOuptutStream().write(getbytes());
   }}
}


-igor


On 1/3/07, Janos Cserep <[EMAIL PROTECTED]> wrote:


Very short, very quick DynamicWebResource tutorial:)

1. Subclass DynamicWebResource

public class MyResource extends DynamicWebResource {

@Override
protected DynamicWebResource.ResourceState getResourceState() {

  return new ResourceState() {

public byte[] getData() {
  return "Example".toBytes("UTF-8");
}

public String getContentType() {
  return "text/plain";
}
   };
}
}

2. Open your Application class and append your init() method with the
following two lines:

getSharedResources().add("myResource", new MyResource( );
mountSharedResource("/my/resource/url", new
ResourceReference("myResource").getSharedResourceKey());

3. Browse to the http://server/context/.../my/resource/url URL and it
should show the "Example" string

4. modify getContentType() and getData() to return your objects (you can
get any HTTP parameter with the getParameter() call of the Resource class in
getData() so you could pass arguments to theURL like
http://server/context/.../my/resource/url?id=XkdfG12


Janos

-
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



-
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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Janos Cserep

Very short, very quick DynamicWebResource tutorial:)

1. Subclass DynamicWebResource

public class MyResource extends DynamicWebResource {

@Override
protected DynamicWebResource.ResourceState getResourceState() {

 return new ResourceState() {

   public byte[] getData() {
 return "Example".toBytes("UTF-8");
   }

   public String getContentType() {
 return "text/plain";
   }
  };
}
}

2. Open your Application class and append your init() method with the
following two lines:

getSharedResources().add("myResource", new MyResource( );
mountSharedResource("/my/resource/url", new
ResourceReference("myResource").getSharedResourceKey());

3. Browse to the http://server/context/.../my/resource/url URL and it should
show the "Example" string

4. modify getContentType() and getData() to return your objects (you can get
any HTTP parameter with the getParameter() call of the Resource class in
getData() so you could pass arguments to theURL like
http://server/context/.../my/resource/url?id=XkdfG12


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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Philip A. Chapman
You have to make your own implemenation of ResourceState.  It's a very
simple class and requires very little to implement.  Check out the very
last section of the UploadDownload page in the wiki:
http://cwiki.apache.org/WICKET/uploaddownload.html

On Wed, 2007-01-03 at 13:07 +0100, Thullner, Robert wrote:
> 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

-- 
Philip A. Chapman

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


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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Martijn Dashorst
Like I said: take a look at the jasper reports integration found at
wicket-stuff svn:

http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-stuff/branches/WICKET_1_2/wicket-contrib-jasperreports/src/java/wicket/contrib/jasperreports/

And for links to the resources:

http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-stuff/branches/WICKET_1_2/wicket-contrib-jasperreports/src/examples/java/wicket/contrib/jasperreports/examples/ReportLinksPage.java?view=markup

Martijn

On 1/3/07, Thullner, Robert <[EMAIL PROTECTED]> wrote:
>
>
> 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
>
>
>


-- 
Vote for Wicket at the http://www.thebeststuffintheworld.com/vote_for/wicket
Wicket 1.2.4 is as easy as 1-2-4. Download Wicket now!
http://wicketframework.org

-
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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Thullner, Robert
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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Philip A. Chapman
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


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


Re: [Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Martijn Dashorst
Take a look at DynamicWebResource

If you need an example, look at the wicket-contrib-jasperreports code
in wicket-stuff svn.

Martijn

On 1/3/07, Thullner, Robert <[EMAIL PROTECTED]> 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
>
>
>


-- 
Vote for Wicket at the http://www.thebeststuffintheworld.com/vote_for/wicket
Wicket 1.2.4 is as easy as 1-2-4. Download Wicket now!
http://wicketframework.org

-
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


[Wicket-user] Writing byte[] to a WebResponse

2007-01-03 Thread Thullner, Robert
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