Tuesday, April 30, 2013

Re: Servlet Response formatting in IE

servlet side:

private String encodeXMLContent(String encodedContent) {
        encodedContent = encodedContent.replace("<", "&lt;");
        encodedContent = encodedContent.replace(">", "&gt;");
        return encodedContent;

On the client side
private String decodeUploadContent(String xml) {
        String result = xml.toLowerCase();
        result = result.replace("&amp;lt;", "<");
        result = result.replace("&amp;gt;", ">");
        result = result.replace("<pre>", "");
        result = result.replace("</pre>", "");
        return result;

суббота, 20 декабря 2008 г., 1:05:42 UTC+3 пользователь D L H написал:

I have a Java servlet that reads an xml-based file and sends the
contents to my gwt application as an HttpServletResponse. I have the
content type set to text/plain in the servlet. On the client side I
use event.getResults() inside the onSubmitComplete method of the form

Everything runs smoothly in Firefox, but when I tested in IE7, it
would not work properly. I used a Label for debugging to see what
exactly the application was reading from the servlet, and in IE i'm
getting a buncha HTML stuff like this:

<DIV class=e><SPAN class=b>&nbsp;</SPAN> <SPAN class=m>&lt;?</
SPAN><SPAN class=pi>xml version="1.0" </SPAN><SPAN class=m>?&gt;</

How do I get IE7 to format my servlet response as plain text instead
of html?

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment