Hello,
I have a little problema using a Stream Result. I don't understand how
to write to an InputStream, I've seen the solution using the
StringBufferInputStream but that is deprecated and if the content is
big, it may be a memory problem.
So I have 2 questions: how to use the stream result without making a
big string first (it's not streaming), and the second, How about to
pass the action an output stream instead of an input stream?

I have made a trial with this:

class ... {
...
protected InputStream inputStream;

       public InputStream getInputStream() {
               return inputStream;
       }

       public void setInputStream(InputStream inputStream) {
               this.inputStream = inputStream;
       }

public String exportProjectDataAsXml(){
PipedOutputStream os = new PipedOutputStream();
PipedInputStream  is = new PipedInputStream(os);
BufferedInputStream is2 = new BufferedInputStream (is);
inputStream = is2;
exportSvc.exportProject(project, os);
return "exportxml";
}
}

In the JDK docs says:
Class PipedOutputStream
...
Attempting to use both objects from a single thread is not recommended
as it may deadlock the thread.

I think I'm doing something very wrong, but how can I convert an
outputStream to an inputStream without writing a string or byte array?

It is deadlocking the tomcat thread.
Does anybody know how to make it work?
Thanks

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco S.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to