Well i think i ve figured it out
the first Problem is in the RequestBuilder class. (Well actually is the
XMLHttpRequest Class)
take a look at the XMLHttpRequest Class in the method *clearOnReadyStateChange
(*line 113)
public final native void clearOnReadyStateChange() /*-{
var self = this;
$wnd.setTimeout(function() {
// Using a function literal here leaks memory on ie6
// Using the same function object kills HtmlUnit
* self.onreadystatechange = new Function();*
}, 0);
}-*/;
this throws an error inside adobe AIR.
So to overcome this i did someting like this inside the RequestBuilder Class
in the doSend Method (around * line 381*)
// Must set the onreadystatechange handler before calling send().
xmlHttpRequest.setOnReadyStateChange(new ReadyStateChangeHandler() {
public void onReadyStateChange(XMLHttpRequest xhr) {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
/**
* Avoide new Function security error in Adobe AIR
*/
* if(! Runtime.isAIRRuntime()){*
* ** *
* ** **xhr.clearOnReadyStateChange();*
* }*
* *
* request.fireOnResponseReceived(callback);*
* }*
}
});
The Runtime class is a class i created my self.
After you have done this you are half way :)
You need to make a change in RemoteServiceServlet class too. Because the
modeBaseURL of the adobe air application istarts with
*app:/ . This will throw an Exeption so you need to change that *
*
*
*i did something like (RemoteServiceServlet around line 41*) * :*
*
*
*
*
*
if (moduleBaseURL != null) {
try {
if(moduleBaseURL.indexOf("app:") >= 0){
moduleBaseURL = moduleBaseURL.replaceFirst("app:/", "
http://127.0.0.1:8888/");
}
modulePath = new URL(moduleBaseURL).getPath();
} catch (MalformedURLException ex) {
// log the information, we will default
servlet.log("Malformed moduleBaseURL: " + moduleBaseURL, ex);
}
}
And after that GWT RPC is running with Adobe AIR.
Hope this could help
greets
*
*
*
*
*
2010/7/11 nino ekambi <[email protected]>
> Yeah you are right.
> It looks the gwt is generating some new Function(){...} constructs,
>
> what adobe air doesnt like.
>
> Anybody has a solution to this ?
> I m also really interested
>
> greets
>
> 2010/7/11 Joe Cole <[email protected]>
>
>> On Jul 11, 1:39 pm, nino ekambi <[email protected]> wrote:
>>
>> > Why dont just use the RequestBuilder and send the response back as
>> JSON or
>> > XML ?
>>
>> Because you have to write some of the conversion process manually
>> which is automated with GWT.
>>
>> Unless you know of a project that is a drop-in replacement for RPC
>> with no extra code required?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-web-toolkit%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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.