Re: export excel file via an OutputStream

2008-04-02 Thread Erik van Oosten

That looks like an excellent API. Would it be very hard to implement this?

Personally I am also looking for something like this, but then 
bookmarkable. I got some suggestions on how to do this with the current 
APIs, but I did not like them at all. So now I am using a servlet.


Regards,
   Erik.


Al Maw wrote:

I think he makes a valid point, personally. People do want to do this sort
of thing quite frequently. It wouldn't kill us to implement an
OutputStreamLink that looked like this:

add(new StreamingLink(link) {
public String getFileName() {
return download.xls;
}
public String getMimeType() {
return application/vnd.excel; // Or whatever it is.
}
public void writeToOutputStream(OutputStream outputStream) {
excelGenerator.writeOutput(outputStream);
}
});

I don't think the current API here is very pleasant or obvious to use.

Regards,

Al

  



--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-02 Thread Igor Vaynberg
it is trivial to implement and can be pretty much factored out of downloadlink.

-igor


On Tue, Apr 1, 2008 at 11:35 PM, Erik van Oosten [EMAIL PROTECTED] wrote:
 That looks like an excellent API. Would it be very hard to implement this?

  Personally I am also looking for something like this, but then
  bookmarkable. I got some suggestions on how to do this with the current
  APIs, but I did not like them at all. So now I am using a servlet.

  Regards,
 Erik.



  Al Maw wrote:
   I think he makes a valid point, personally. People do want to do this sort
   of thing quite frequently. It wouldn't kill us to implement an
   OutputStreamLink that looked like this:
  
   add(new StreamingLink(link) {
   public String getFileName() {
   return download.xls;
   }
   public String getMimeType() {
   return application/vnd.excel; // Or whatever it is.
   }
   public void writeToOutputStream(OutputStream outputStream) {
   excelGenerator.writeOutput(outputStream);
   }
   });
  
   I don't think the current API here is very pleasant or obvious to use.
  
   Regards,
  
   Al
  
  


  --
  Erik van Oosten
  http://www.day-to-day-stuff.blogspot.com/



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-02 Thread Johan Compagner
stream = class AbstractResourceStreamWriter()
{
public void write(OutputStream output)
{
 // do youre writing
}
}

  getRequestCycle().setRequestTarget(new
ResourceStreamRequestTarget(stream).setFileName(file.xls));

johan


On Tue, Apr 1, 2008 at 9:31 AM, [EMAIL PROTECTED] wrote:

 Hello:
 I am trying to export dynamically generated excel file.
 The generator would send the file.xls to an OutputStream.

 In wicket, I am trying to use example as below but
  how can I connect the OutputStream to the inputstream
 ins.  Pipedoutputstream would block. Using a separate thread
 is not desirable.

 public void onClick() {

   IResourceStream stream = new AbstractResourceStream() {

 public InputStream getInputStream() throws
 ResourceStreamNotFoundException {


 return ins;
 }

 public void close() throws IOException {
 ins.close();
 }
 };

 getRequestCycle().setRequestTarget(
 new
 ResourceStreamRequestTarget(stream).setFileName(file.xls));


Re: export excel file via an OutputStream

2008-04-02 Thread dvd
That is exactly what I am looking for.  Perhaps someone could show a sample
of implementation or even better to make it in the release?
Sorry if there was any misunderstanding of my question but this is something
Wicket should excel against other frameworks.

That looks like an excellent API. Would it be very hard to implement this?

Personally I am also looking for something like this, but then 
bookmarkable. I got some suggestions on how to do this with the current 
APIs, but I did not like them at all. So now I am using a servlet.

Regards,
Erik.


Al Maw wrote:
 I think he makes a valid point, personally. People do want to do this sort
 of thing quite frequently. It wouldn't kill us to implement an
 OutputStreamLink that looked like this:

 add(new StreamingLink(link) {
 public String getFileName() {
 return download.xls;
 }
 public String getMimeType() {
 return application/vnd.excel; // Or whatever it is.
 }
 public void writeToOutputStream(OutputStream outputStream) {
 excelGenerator.writeOutput(outputStream);
 }
 });

 I don't think the current API here is very pleasant or obvious to use.

 Regards,

 Al

   


--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-02 Thread dvd
Never mind. I just saw and tested Johan Campagner's posted solution and it 
resolves
all issues. This is why I like Wicket and its developers.

That is exactly what I am looking for.  Perhaps someone could show a sample
of implementation or even better to make it in the release?
Sorry if there was any misunderstanding of my question but this is something
Wicket should excel against other frameworks.

That looks like an excellent API. Would it be very hard to implement this?

Personally I am also looking for something like this, but then 
bookmarkable. I got some suggestions on how to do this with the current 
APIs, but I did not like them at all. So now I am using a servlet.

Regards,
Erik.


Al Maw wrote:
 I think he makes a valid point, personally. People do want to do this sort
 of thing quite frequently. It wouldn't kill us to implement an
 OutputStreamLink that looked like this:

 add(new StreamingLink(link) {
 public String getFileName() {
 return download.xls;
 }
 public String getMimeType() {
 return application/vnd.excel; // Or whatever it is.
 }
 public void writeToOutputStream(OutputStream outputStream) {
 excelGenerator.writeOutput(outputStream);
 }
 });

 I don't think the current API here is very pleasant or obvious to use.

 Regards,

 Al

   


--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



export excel file via an OutputStream

2008-04-01 Thread dvd
Hello:
I am trying to export dynamically generated excel file.
The generator would send the file.xls to an OutputStream.

In wicket, I am trying to use example as below but
 how can I connect the OutputStream to the inputstream
ins.  Pipedoutputstream would block. Using a separate thread
is not desirable.

public void onClick() {
 
  IResourceStream stream = new AbstractResourceStream() {

    public InputStream getInputStream() throws 
ResourceStreamNotFoundException {
 
    
    return ins;
    }

    public void close() throws IOException {
    ins.close();
    }
    };
    
    getRequestCycle().setRequestTarget(
    new 
ResourceStreamRequestTarget(stream).setFileName(file.xls));

Re: export excel file via an OutputStream

2008-04-01 Thread Igor Vaynberg
see Streams.copy() in wicket utils package

-igor

On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
 Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.

  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.

  public void onClick() {

IResourceStream stream = new AbstractResourceStream() {

  public InputStream getInputStream() throws 
 ResourceStreamNotFoundException {


  return ins;
  }

  public void close() throws IOException {
  ins.close();
  }
  };

  getRequestCycle().setRequestTarget(
  new 
 ResourceStreamRequestTarget(stream).setFileName(file.xls));

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread dvd
This does not apply as it copies input to output.
My issue is that in OnClick()  I  call

excelGen(OutputStream)

to produce the bytes on the fly.  but the ResourceStream
needs InputStream that wicket would read data to send as response.
My take is that I need to get a handle of the reponse
outputstream to pass it to excelGen. But How to do it at wicket api level 
instead
of bypass it to directly get servlet reponse stream.

see Streams.copy() in wicket utils package

-igor

On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
 Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.

  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.

  public void onClick() {

IResourceStream stream = new AbstractResourceStream() {

  public InputStream getInputStream() throws 
ResourceStreamNotFoundException {


  return ins;
  }

  public void close() throws IOException {
  ins.close();
  }
  };

  getRequestCycle().setRequestTarget(
  new 
ResourceStreamRequestTarget(stream).setFileName(file.xls));

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread Igor Vaynberg
is it really that difficult to do some legwork?

the hint in downloadlink is to do
getrequestcycle().setrequesttarget(new irequesttarget() {..});

irequesttarget has a respond(requestcycle cycle);

cycle in turn has a cycle.getresponse().getoutputstream().

-igor


On Tue, Apr 1, 2008 at 12:59 AM,  [EMAIL PROTECTED] wrote:
 This one (even with model args) falls to the same category of
  getting the inputstream actively. I do not see how I can
  define the model to get data since the controlling side is
  excelGen(outputstream). it keeps writing data to outputstream.
  and I am trying to get it directly send back to browser.
  It has to directly write to the response stream in a single thread
  or it would block.



  see DownloadLink
  
  -igor
  
  
  On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
   This does not apply as it copies input to output.
My issue is that in OnClick()  I  call
  
excelGen(OutputStream)
  
to produce the bytes on the fly.  but the ResourceStream
needs InputStream that wicket would read data to send as response.
My take is that I need to get a handle of the reponse
outputstream to pass it to excelGen. But How to do it at wicket api level
  instead
of bypass it to directly get servlet reponse stream.
  
  
  
see Streams.copy() in wicket utils package

-igor

On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
 Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.

  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.

  public void onClick() {

IResourceStream stream = new AbstractResourceStream() {

  public InputStream getInputStream() throws
ResourceStreamNotFoundException {


  return ins;
  }

  public void close() throws IOException {
  ins.close();
  }
  };

  getRequestCycle().setRequestTarget(
  new
ResourceStreamRequestTarget(stream).setFileName(file.xls));

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread dvd
In a raw servlet programming, it is trivial,
just get response outputstream, set headers and pass it
to the excelGen (as a poorman's way, close the connection after done)
Wicket got to have a more structured api for this common task.

This one (even with model args) falls to the same category of
getting the inputstream actively. I do not see how I can 
define the model to get data since the controlling side is
excelGen(outputstream). it keeps writing data to outputstream.
and I am trying to get it directly send back to browser.
It has to directly write to the response stream in a single thread
or it would block. 

see DownloadLink

-igor


On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
 This does not apply as it copies input to output.
  My issue is that in OnClick()  I  call

  excelGen(OutputStream)

  to produce the bytes on the fly.  but the ResourceStream
  needs InputStream that wicket would read data to send as response.
  My take is that I need to get a handle of the reponse
  outputstream to pass it to excelGen. But How to do it at wicket api level 

instead
  of bypass it to directly get servlet reponse stream.



  see Streams.copy() in wicket utils package
  
  -igor
  
  On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
   Hello:
I am trying to export dynamically generated excel file.
The generator would send the file.xls to an OutputStream.
  
In wicket, I am trying to use example as below but
 how can I connect the OutputStream to the inputstream
ins.  Pipedoutputstream would block. Using a separate thread
is not desirable.
  
public void onClick() {
  
  IResourceStream stream = new AbstractResourceStream() {
  
public InputStream getInputStream() throws
  ResourceStreamNotFoundException {
  
  
return ins;
}
  
public void close() throws IOException {
ins.close();
}
};
  
getRequestCycle().setRequestTarget(
new
  ResourceStreamRequestTarget(stream).setFileName(file.xls));
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread dvd
FY.  Once you reach getResponse.getOutputStream, you are back to
square one with servlet programming.  

wtf

-igor


On Tue, Apr 1, 2008 at 1:12 AM,  [EMAIL PROTECTED] wrote:
 In a raw servlet programming, it is trivial,
  just get response outputstream, set headers and pass it
  to the excelGen (as a poorman's way, close the connection after done)
  Wicket got to have a more structured api for this common task.



  This one (even with model args) falls to the same category of
  getting the inputstream actively. I do not see how I can
  define the model to get data since the controlling side is
  excelGen(outputstream). it keeps writing data to outputstream.
  and I am trying to get it directly send back to browser.
  It has to directly write to the response stream in a single thread
  or it would block.
  
  see DownloadLink
  
  -igor
  
  
  On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
   This does not apply as it copies input to output.
My issue is that in OnClick()  I  call
  
excelGen(OutputStream)
  
to produce the bytes on the fly.  but the ResourceStream
needs InputStream that wicket would read data to send as response.
My take is that I need to get a handle of the reponse
outputstream to pass it to excelGen. But How to do it at wicket api 
level
  
  instead
of bypass it to directly get servlet reponse stream.
  
  
  
see Streams.copy() in wicket utils package

-igor

On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
 Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.

  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.

  public void onClick() {

IResourceStream stream = new AbstractResourceStream() {

  public InputStream getInputStream() 
throws
ResourceStreamNotFoundException {


  return ins;
  }

  public void close() throws IOException {
  ins.close();
  }
  };

  getRequestCycle().setRequestTarget(
  new
ResourceStreamRequestTarget(stream).setFileName(file.xls));


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread Mats Norén
What's the problem with that?

You want an OutputStream to send to your excelGen and Igor showed you
how to obtain one...what else do you need?

/M

On Tue, Apr 1, 2008 at 12:06 PM,  [EMAIL PROTECTED] wrote:
 FY.  Once you reach getResponse.getOutputStream, you are back to
  square one with servlet programming.



  wtf
  
  -igor
  
  
  On Tue, Apr 1, 2008 at 1:12 AM,  [EMAIL PROTECTED] wrote:
   In a raw servlet programming, it is trivial,
just get response outputstream, set headers and pass it
to the excelGen (as a poorman's way, close the connection after done)
Wicket got to have a more structured api for this common task.
  
  
  
This one (even with model args) falls to the same category of
getting the inputstream actively. I do not see how I can
define the model to get data since the controlling side is
excelGen(outputstream). it keeps writing data to outputstream.
and I am trying to get it directly send back to browser.
It has to directly write to the response stream in a single thread
or it would block.

see DownloadLink

-igor


On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
 This does not apply as it copies input to output.
  My issue is that in OnClick()  I  call

  excelGen(OutputStream)

  to produce the bytes on the fly.  but the ResourceStream
  needs InputStream that wicket would read data to send as response.
  My take is that I need to get a handle of the reponse
  outputstream to pass it to excelGen. But How to do it at wicket api
  level

instead
  of bypass it to directly get servlet reponse stream.



  see Streams.copy() in wicket utils package
  
  -igor
  
  On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
   Hello:
I am trying to export dynamically generated excel file.
The generator would send the file.xls to an OutputStream.
  
In wicket, I am trying to use example as below but
 how can I connect the OutputStream to the inputstream
ins.  Pipedoutputstream would block. Using a separate thread
is not desirable.
  
public void onClick() {
  
  IResourceStream stream = new AbstractResourceStream() {
  
public InputStream getInputStream()
  throws
  ResourceStreamNotFoundException {
  
  
return ins;
}
  
public void close() throws IOException {
ins.close();
}
};
  
getRequestCycle().setRequestTarget(
new
  ResourceStreamRequestTarget(stream).setFileName(file.xls));
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread Nino Saturnino Martinez Vazquez Wael

I guess what he wanted where something like response.writeArray or like?

Mats Norén wrote:

What's the problem with that?

You want an OutputStream to send to your excelGen and Igor showed you
how to obtain one...what else do you need?

/M

On Tue, Apr 1, 2008 at 12:06 PM,  [EMAIL PROTECTED] wrote:
  

FY.  Once you reach getResponse.getOutputStream, you are back to
 square one with servlet programming.



 wtf
 
 -igor
 
 
 On Tue, Apr 1, 2008 at 1:12 AM,  [EMAIL PROTECTED] wrote:
  In a raw servlet programming, it is trivial,
   just get response outputstream, set headers and pass it
   to the excelGen (as a poorman's way, close the connection after done)
   Wicket got to have a more structured api for this common task.
 
 
 
   This one (even with model args) falls to the same category of
   getting the inputstream actively. I do not see how I can
   define the model to get data since the controlling side is
   excelGen(outputstream). it keeps writing data to outputstream.
   and I am trying to get it directly send back to browser.
   It has to directly write to the response stream in a single thread
   or it would block.
   
   see DownloadLink
   
   -igor
   
   
   On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
This does not apply as it copies input to output.
 My issue is that in OnClick()  I  call
   
 excelGen(OutputStream)
   
 to produce the bytes on the fly.  but the ResourceStream
 needs InputStream that wicket would read data to send as response.
 My take is that I need to get a handle of the reponse
 outputstream to pass it to excelGen. But How to do it at wicket api
 level
   
   instead
 of bypass it to directly get servlet reponse stream.
   
   
   
 see Streams.copy() in wicket utils package
 
 -igor
 
 On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
  Hello:
   I am trying to export dynamically generated excel file.
   The generator would send the file.xls to an OutputStream.
 
   In wicket, I am trying to use example as below but
how can I connect the OutputStream to the inputstream
   ins.  Pipedoutputstream would block. Using a separate thread
   is not desirable.
 
   public void onClick() {
 
 IResourceStream stream = new AbstractResourceStream() {
 
   public InputStream getInputStream()
 throws
 ResourceStreamNotFoundException {
 
 
   return ins;
   }
 
   public void close() throws IOException {
   ins.close();
   }
   };
 
   getRequestCycle().setRequestTarget(
   new
 ResourceStreamRequestTarget(stream).setFileName(file.xls));
 
   
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
   
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
 
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread James Carman
Well, if you're using WicketFilter, then you can just write your own
servlet.  If WicketFilter doesn't think it's responsible for the
request, it'll let it flow through.  So, you could just code this
using Servlets anyway.

Wouldn't extending WebResource and using ResourceLink be the way to do
this within Wicket, though?  Looking at the API, that seems like the
way to go.


On Tue, Apr 1, 2008 at 8:00 AM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
 I guess what he wanted where something like response.writeArray or like?



  Mats Norén wrote:
   What's the problem with that?
  
   You want an OutputStream to send to your excelGen and Igor showed you
   how to obtain one...what else do you need?
  
   /M
  
   On Tue, Apr 1, 2008 at 12:06 PM,  [EMAIL PROTECTED] wrote:
  
   FY.  Once you reach getResponse.getOutputStream, you are back to
square one with servlet programming.
  
  
  
wtf

-igor


On Tue, Apr 1, 2008 at 1:12 AM,  [EMAIL PROTECTED] wrote:
 In a raw servlet programming, it is trivial,
  just get response outputstream, set headers and pass it
  to the excelGen (as a poorman's way, close the connection after done)
  Wicket got to have a more structured api for this common task.



  This one (even with model args) falls to the same category of
  getting the inputstream actively. I do not see how I can
  define the model to get data since the controlling side is
  excelGen(outputstream). it keeps writing data to outputstream.
  and I am trying to get it directly send back to browser.
  It has to directly write to the response stream in a single thread
  or it would block.
  
  see DownloadLink
  
  -igor
  
  
  On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
   This does not apply as it copies input to output.
My issue is that in OnClick()  I  call
  
excelGen(OutputStream)
  
to produce the bytes on the fly.  but the ResourceStream
needs InputStream that wicket would read data to send as 
 response.
My take is that I need to get a handle of the reponse
outputstream to pass it to excelGen. But How to do it at wicket 
 api
level
  
  instead
of bypass it to directly get servlet reponse stream.
  
  
  
see Streams.copy() in wicket utils package

-igor

On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
 Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.

  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.

  public void onClick() {

IResourceStream stream = new AbstractResourceStream() {

  public InputStream getInputStream()
throws
ResourceStreamNotFoundException {


  return ins;
  }

  public void close() throws 
 IOException {
  ins.close();
  }
  };

  getRequestCycle().setRequestTarget(
  new
ResourceStreamRequestTarget(stream).setFileName(file.xls));

  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  

 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For 

Re: export excel file via an OutputStream

2008-04-01 Thread Nino Saturnino Martinez Vazquez Wael



James Carman wrote:

Well, if you're using WicketFilter, then you can just write your own
servlet.  If WicketFilter doesn't think it's responsible for the
request, it'll let it flow through.  So, you could just code this
using Servlets anyway.
  
I think the point were that he wanted something higher level than a 
servlet.. But again thats just me guessing..

Wouldn't extending WebResource and using ResourceLink be the way to do
this within Wicket, though?  Looking at the API, that seems like the
way to go.

  

Yeah it seems like a good idea, and the way to go:)

On Tue, Apr 1, 2008 at 8:00 AM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
  

I guess what he wanted where something like response.writeArray or like?



 Mats Norén wrote:
  What's the problem with that?
 
  You want an OutputStream to send to your excelGen and Igor showed you
  how to obtain one...what else do you need?
 
  /M
 
  On Tue, Apr 1, 2008 at 12:06 PM,  [EMAIL PROTECTED] wrote:
 
  FY.  Once you reach getResponse.getOutputStream, you are back to
   square one with servlet programming.
 
 
 
   wtf
   
   -igor
   
   
   On Tue, Apr 1, 2008 at 1:12 AM,  [EMAIL PROTECTED] wrote:
In a raw servlet programming, it is trivial,
 just get response outputstream, set headers and pass it
 to the excelGen (as a poorman's way, close the connection after done)
 Wicket got to have a more structured api for this common task.
   
   
   
 This one (even with model args) falls to the same category of
 getting the inputstream actively. I do not see how I can
 define the model to get data since the controlling side is
 excelGen(outputstream). it keeps writing data to outputstream.
 and I am trying to get it directly send back to browser.
 It has to directly write to the response stream in a single thread
 or it would block.
 
 see DownloadLink
 
 -igor
 
 
 On Tue, Apr 1, 2008 at 12:45 AM,  [EMAIL PROTECTED] wrote:
  This does not apply as it copies input to output.
   My issue is that in OnClick()  I  call
 
   excelGen(OutputStream)
 
   to produce the bytes on the fly.  but the ResourceStream
   needs InputStream that wicket would read data to send as response.
   My take is that I need to get a handle of the reponse
   outputstream to pass it to excelGen. But How to do it at wicket 
api
   level
 
 instead
   of bypass it to directly get servlet reponse stream.
 
 
 
   see Streams.copy() in wicket utils package
   
   -igor
   
   On Tue, Apr 1, 2008 at 12:31 AM,  [EMAIL PROTECTED] wrote:
Hello:
 I am trying to export dynamically generated excel file.
 The generator would send the file.xls to an OutputStream.
   
 In wicket, I am trying to use example as below but
  how can I connect the OutputStream to the inputstream
 ins.  Pipedoutputstream would block. Using a separate thread
 is not desirable.
   
 public void onClick() {
   
   IResourceStream stream = new AbstractResourceStream() {
   
 public InputStream getInputStream()
   throws
   ResourceStreamNotFoundException {
   
   
 return ins;
 }
   
 public void close() throws 
IOException {
 ins.close();
 }
 };
   
 getRequestCycle().setRequestTarget(
 new
   ResourceStreamRequestTarget(stream).setFileName(file.xls));
   
 
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
 
   
-
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
   
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
 
   

Re: export excel file via an OutputStream

2008-04-01 Thread Peter Ertl

use AbstractResourceStreamWriter

 Wicket got to have a more structured api for this common task.
usually it's not wicket but you when something is not working the way  
you expect it






Am 01.04.2008 um 09:31 schrieb [EMAIL PROTECTED]:


Hello:
I am trying to export dynamically generated excel file.
The generator would send the file.xls to an OutputStream.

In wicket, I am trying to use example as below but
 how can I connect the OutputStream to the inputstream
ins.  Pipedoutputstream would block. Using a separate thread
is not desirable.

public void onClick() {

  IResourceStream stream = new AbstractResourceStream() {

public InputStream getInputStream() throws  
ResourceStreamNotFoundException {



return ins;
}

public void close() throws IOException {
ins.close();
}
};

getRequestCycle().setRequestTarget(
new  
ResourceStreamRequestTarget(stream).setFileName(file.xls));



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: export excel file via an OutputStream

2008-04-01 Thread Al Maw
I think he makes a valid point, personally. People do want to do this sort
of thing quite frequently. It wouldn't kill us to implement an
OutputStreamLink that looked like this:

add(new StreamingLink(link) {
public String getFileName() {
return download.xls;
}
public String getMimeType() {
return application/vnd.excel; // Or whatever it is.
}
public void writeToOutputStream(OutputStream outputStream) {
excelGenerator.writeOutput(outputStream);
}
});

I don't think the current API here is very pleasant or obvious to use.

Regards,

Al

On Tue, Apr 1, 2008 at 1:15 PM, Peter Ertl [EMAIL PROTECTED] wrote:

 use AbstractResourceStreamWriter

   Wicket got to have a more structured api for this common task.
 usually it's not wicket but you when something is not working the way
 you expect it





 Am 01.04.2008 um 09:31 schrieb [EMAIL PROTECTED]:

  Hello:
  I am trying to export dynamically generated excel file.
  The generator would send the file.xls to an OutputStream.
 
  In wicket, I am trying to use example as below but
   how can I connect the OutputStream to the inputstream
  ins.  Pipedoutputstream would block. Using a separate thread
  is not desirable.
 
  public void onClick() {
 
IResourceStream stream = new AbstractResourceStream() {
 
  public InputStream getInputStream() throws
  ResourceStreamNotFoundException {
 
 
  return ins;
  }
 
  public void close() throws IOException {
  ins.close();
  }
  };
 
  getRequestCycle().setRequestTarget(
  new
  ResourceStreamRequestTarget(stream).setFileName(file.xls));


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]