Re: Weird EOF Exception while trying to download file from GWT application

2010-12-23 Thread Patrick Tucker
I know this sounds crazy but in the past I've run into this and this
seemed to fixed the problem...

...
OutputStream os;

try
{
os = response.getOutputStream(),

BufferedOutputStream output = new BufferedOutputStream(os,
DEFAULT_BUFFER_SIZE);
...
}

if (os != null)  os.flush();

Also, have you tried wrapping the flush() in a try catch and ignore
the thrown exception?

On Dec 23, 5:13 am, tarun  wrote:
> Hi,
> I am trying to download a file from GWT client. At server side there
> is a servlet which generates content of file as per request and send
> it back to the client.
>
> Test Scenarios:
>
> Scenario 1 If I hit url of servlet directly, it always give me desired
> result without any problems.
>
> Scenario 2 Using GWT client on IE8,I am able to download file without
> any code changes. However on some other computer as soon as I try to
> write file content on response output stream, I get EOF exception.
>
> org.mortbay.jetty.EofException
> at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760)
> at org.mortbay.jetty.AbstractGenerator
> $Output.flush(AbstractGenerator.java:566)
> at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:
> 911)
> at java.io.BufferedOutputStream.flush(Unknown Source)
> at.doGet(ServiceDataExporterServlet.jav­a:
> 110)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:
> 717)Creating input stream
>
> Code of servlet is as follows:
>
> try
> {
> output = new BufferedOutputStream(response.getOutputStream(),
> DEFAULT_BUFFER_SIZE);
> byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
> int length;
> int bytesWritten=0;
> while ((length = data.read(buffer)) > 0) {
> bytesWritten+=length;
> output.write(buffer, 0, length);}
>
> output.flush() // At this point I am facing EOF exception.
>
> where data is inputStream
>
> Via means of bytesWritten variable I have confirmed that in all the
> three scenarios content has been written in the same way in output
> stream. But not sure why it is not working in some computers.
>
> Any pointers will be highly appereciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Weird EOF Exception while trying to download file from GWT application

2010-12-23 Thread tarun
Hi,
I am trying to download a file from GWT client. At server side there
is a servlet which generates content of file as per request and send
it back to the client.

Test Scenarios:

Scenario 1 If I hit url of servlet directly, it always give me desired
result without any problems.

Scenario 2 Using GWT client on IE8,I am able to download file without
any code changes. However on some other computer as soon as I try to
write file content on response output stream, I get EOF exception.

org.mortbay.jetty.EofException
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760)
at org.mortbay.jetty.AbstractGenerator
$Output.flush(AbstractGenerator.java:566)
at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:
911)
at java.io.BufferedOutputStream.flush(Unknown Source)
at.doGet(ServiceDataExporterServlet.java:
110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)Creating input stream


Code of servlet is as follows:


try
{
output = new BufferedOutputStream(response.getOutputStream(),
DEFAULT_BUFFER_SIZE);
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int length;
int bytesWritten=0;
while ((length = data.read(buffer)) > 0) {
bytesWritten+=length;
output.write(buffer, 0, length);
}
output.flush() // At this point I am facing EOF exception.

where data is inputStream

Via means of bytesWritten variable I have confirmed that in all the
three scenarios content has been written in the same way in output
stream. But not sure why it is not working in some computers.

Any pointers will be highly appereciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.