"pre" tags wrapping json response during image upload

1,832 views
Skip to first unread message

Trevis

unread,
Jan 16, 2010, 11:45:36 AM1/16/10
to Google Web Toolkit
Ok so, i noticed when i return json from a servlet that i'm using to
handle image uploads that the reply was wrapped in a <pre> tag, i put
in code to scrape it off and all seemed fine, till i tested in ie8.
In that browser the pre tag was upper case! so i fixed that. Today i
decide to test in chrome and in that browser it's wrapped in this <pre
style="word-wrap: break-word; white-space: pre-wrap;"> what gives??!
Am i doing something wrong that is causing it to do this? I'm worried
now that i'll have to check in every browser just to see what this
thing does.


Thomas Broyer

unread,
Jan 17, 2010, 11:05:39 AM1/17/10
to Google Web Toolkit

Just return text/html, as recommended in the JavaDoc (and don't forget
to use &lt; for < and &amp; for &)

Trevis

unread,
Jan 18, 2010, 10:57:10 AM1/18/10
to Google Web Toolkit
Kudos sir, it seems that worked like a charm. I had the type set to
text/plain in my servlet. What javadoc has this recommendation? I'm
just curious. Is it in the doc for GWT somewhere or in the apache
commons doc?

I actually got my base implementation for the file uploader from the
Google Web Toolkit Solutions book, and he called the issue a bug. ( I
think that his book was written against GWT 1.3 ) I just assumed that
it'd never been fixed. But i guess it was probably never a GWT bug.

http://www.amazon.com/Google-Web-Toolkit-Solutions-Useful/dp/0132344815

Trevis

Reply all
Reply to author
Forward
0 new messages