Sorry for resurrecting dead post, but every time I'm looking how to implement something gwt'ish I find your answer Thomas, and it always helpful! Thank you.
On Monday, June 4, 2012 3:59:35 PM UTC+2, Thomas Broyer wrote: > > > > On Monday, June 4, 2012 2:53:28 PM UTC+2, Magallo wrote: >> >> Hi, I tried to use your solution. Looking at Google I/O on youtube ( >> http://www.youtube.com/watch?v=NNmoEOpGJdk) I saw this but I wasn't able >> to do it. >> >> I tried creating this: >> >> public class BinaryXMLHttpRequest extends XMLHttpRequest >> { >> public native JavaScriptObject getResponse() >> /*- >> { >> return this.response; >> } >> -*/; >> >> //Set to "arraybuffer" or "blob" for binary response >> public native void setResponseType(String value) >> /*- >> { >> this.responseType = value; >> } >> -*/; >> } >> >> then I used this class this way: >> >> BinaryXMLHttpRequest binxhr = >> (BinaryXMLHttpRequest)BinaryXMLHttpRequest.create(); >> binxhr.open("GET", "myservlet_url"); >> binxhr.setResponseType("arraybuffer"); >> >> binxhr.setOnReadyStateChange(new ReadyStateChangeHandler() >> { >> @Override >> public void onReadyStateChange(XMLHttpRequest xhr) >> { >> BinaryXMLHttpRequest binxhr = (BinaryXMLHttpRequest)xhr; >> if( binxhr.getReadyState() == XMLHttpRequest.DONE ) >> { >> binxhr.clearOnReadyStateChange(); >> binxhr.getResponse(); => what can I do with this? >> } >> } >> }); >> >> If you look, at the end I have a binxhr.getResponse(); But this function >> returna a JavaScriptObject type. What can I do now with this? This is not a >> byte[] or whatever, so, I don't know in GWT how to manipulate it. Do you >> have an idea? > > > It will be an ArrayBuffer, so you'd have to build a JSO overlay type > representing ArrayBuffer and cast() the JSO to your ArrayBuffer. > > But honestly, it'd be easier to compile GWT from trunk and use the API > that's already in there. When 2.5 will be out the doors, simply replace > your home-built pre-2.5 GWT with the official 2.5. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/D1twPUQTxEMJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
