Friday, March 13, 2015

Re: FileUpload mucking my response

I use GWT's FileUpload widget a lot, mostly for stuff that I'm storing on the server--binary files, MS Office files, etc. On the server side I use FileUpload from the Apache Commons to grab and store the file(s) before other libraries do something with it.

What are you doing on the server side to set the HTTP response to the user? Are you sending back a short string or the entire file? Are you calling response.setContentLength()? What's the server? I recall a but in WebLogic years ago that would not close and flush the response when the servlet finished. I had to do it myself.

When I have to return the file--say it's text I want to display in a TextArea--I don't send it back in the same servlet that did the upload. I send the user a short OK and maybe some other info about the upload, then make a second call to retrieve the file or some portion of it. In the case of a PDF or some other binary, this lets me set the MIME type properly.

On Wednesday, March 11, 2015 at 5:42:56 PM UTC-4, Thomas Lefort wrote:
I am using FileUpload to retrieve the content of a file.

The response I get is perfect, headers are correct, I use text/html, the length is correct.

Everything is fine until I fetch the response using event.getResults(). At this point some extra characters are added at the end. It can be several hundreds of characters.

Has anybody had this problem before? Is there some gotcha I am not aware of? I use GWT 2.6.1.

Thanks!


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment