Closed GoogleCodeExporter closed 9 years ago
IE and Firefox/Chrome are parsing the text/html response differently. This
seems to be due to the doPost method of UploadAction executing the
renderHtmlResponse() method sending text/html instead of the text/xml or
text/plain that I was expecting. I resolved this by overriding the doPost
method and removing the condition that called the renderHtmlResponse() method.
Original comment by umpire...@gmail.com
on 5 Aug 2010 at 5:14
It is weird, because sending text/xml didn't work in IE6 time ago. I have to
take a look again.
Original comment by manuel.carrasco.m
on 23 Aug 2010 at 1:47
I checked the POST, everything seems fine when the xml is arriving. Looks like
the javascript (either gwt or gwt-upload) is messing things up..
Original comment by clon...@gmail.com
on 23 Aug 2010 at 1:51
Yes, the issue is in client side, when the response comes, it is displayed in a
hidden iframe, and the problem is in how GWT reads the content of the iframe,
depending on the browser if the server response is text/xml then the content of
the iframe document can not be read. When I was playing with this text/plain
seemed to work with all browsers.
Original comment by manuel.carrasco.m
on 23 Aug 2010 at 1:57
Hi,
Same issue here.
I tried the fix mentionned in comment 1 but it didn't work.
Do you have another solution ?
Thanks,
Thomas
Original comment by thomas.frezel@gmail.com
on 16 Sep 2010 at 1:52
I have a workaround for this, in your client code add a native method to get
the browser version:
public static native String getUserAgent() /*-{
return navigator.userAgent.toLowerCase();
}-*/;
Then add
if(getUserAgent().contains("msie"))
{
xml = "<RESPONSE><FILE-1-FIELD>" + xml;
xml = xml.toLowerCase();
}
This is just a hack to get my app working in IE8, but it works.
The returned xml is capitialised in IE8. In IE7 only null is returned.
James
Original comment by james.gu...@googlemail.com
on 1 Oct 2010 at 6:46
that workaround will not work for us. We get
com.google.gwt.xml.client.impl.DOMParseException:
Failed to parse: GWTU-008588957556429666</FILE-1-FIELD>
<FILE-1-NAME>b7KjjcEH6stBzxZW6JnPcA==</FILE-1-NAME>
<FILE-1-SIZE>28521</FILE-1-SIZE> <FIL
in IE7 on uploading. Firefox works fine.
Original comment by per.ab...@gmail.com
on 25 Nov 2010 at 1:12
My work around:
I keep renderHtmlResponse with text/html ('text/plain'
cannot be made to work properly on all browsers)
[Server code] in my executeAction, I put my xml between html comment :
return "<html><head><title>results</title></head><body><!--<response>\n" +
xmlResponse + "</response>\n--></body></html>";
[client code]
// remove comment before parse xml
private String extractXml(String serverResponse) {
String result = serverResponse;
int startIndex = result.indexOf("<!--") + 4;
int endIndex = result.indexOf("-->") - 1;
if (startIndex > -1 && endIndex > -1) {
result = result.substring(startIndex, endIndex);
}
return result;
}
public void parseReponse(String serverResponse) {
serverResponse = extractXml(serverResponse);
// You can parse this information using XML or JSON libraries
com.google.gwt.xml.client.Document doc = XMLParser
.parse(serverResponse);
serverResponse = extractXml(serverResponse);
// You can parse this information using XML or JSON libraries
com.google.gwt.xml.client.Document doc = XMLParser
.parse(serverResponse);
...
}
It's work with IE7 IE8 and FF3.6
It should be better to do somthing like his in Uplaoder class :
private SubmitCompleteHandler onSubmitCompleteHandler = new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
String result = event.getResults();
int startIndex = result.indexOf("<!--")+4;
int endIndex = result.indexOf("-->")-1;
if(startIndex>-1 && endIndex>-1) {
result = result.substring(startIndex,endIndex);
}
serverResponse = result;
log("onSubmitComplete: " + serverResponse, null);
}
};
I found this solution when I read this thread:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/cae1d9922
2fec795/8b94b2a26a911682?show_docid=8b94b2a26a911682
Original comment by b.mouch...@gmail.com
on 3 Dec 2010 at 3:33
Hello, latest snapshot has a workaround for this, could you test if it works
for you
thanks.
- Manolo
Original comment by manuel.carrasco.m
on 29 Dec 2010 at 10:35
Original comment by manuel.carrasco.m
on 29 Dec 2010 at 3:29
[deleted comment]
Hi
The latest snapshot works fine with IE. Thank you for the fix.
--Kiran
Original comment by veeravel...@gmail.com
on 6 Jan 2011 at 9:39
I am using the latest snapshot, but the ServerResponse always starts with
"GWTU-" and strips away the two XML tags that were infront of it. I am using
fiddler to check what the server is delivering, and the response comes out fine
from the server. I have tried looking at it via the Development mode in Debug,
but everywhere I look, I see the truncated Output.
Original comment by per.ab...@gmail.com
on 19 Jan 2011 at 1:35
I have tried something stupid: I have added the following to my ServletCode:
response="GWTU-"+response;
and now the response is complete - with GWTU- prepended to the
"servletResponse".
Is there some placve in the code, where U are searching the response for
"GWTU-"?
Original comment by per.ab...@gmail.com
on 19 Jan 2011 at 1:39
Original comment by manuel.carrasco.m
on 7 Feb 2011 at 6:34
Original issue reported on code.google.com by
umpire...@gmail.com
on 3 Aug 2010 at 6:09Attachments: