Re: GWT RPC with Adobe AIR 2

2010-07-13 Thread Gurufaction
I found it easier to modify the cache.html file and replace
self.onreadystatechange = new Function with self.onreadystatechange =
function(){}

I tried to modify the RPC Url with the setServiceEntryPont() method
which changes the URL but the request method is no longer POST but
OPTIONS. I tried creating a custom RpcRequestBuilder and still uses
the OPTIONS method.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-12 Thread nino ekambi
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:/;);

}


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 jazzmatad...@googlemail.com

 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 profilercorporat...@gmail.com

 On Jul 11, 1:39 pm, nino ekambi jazzmatad...@googlemail.com 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 google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-11 Thread Joe Cole
On Jul 11, 1:39 pm, nino ekambi jazzmatad...@googlemail.com 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-11 Thread nino ekambi
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 profilercorporat...@gmail.com

 On Jul 11, 1:39 pm, nino ekambi jazzmatad...@googlemail.com 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 google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-10 Thread Joe Cole
We have a very large app that uses air extensively (both online and
offline modes). We had to jump through many hoops to get RPC working.

For AIR compiles, we replace the following class with this method:

public final class ClientSerializationStreamReader extends
AbstractSerializationStreamReader {

private static native JavaScriptObject eval(String encoded) /*-{
   return $wnd.parseGwtRpc(encoded);
 }-*/;

... etc

}

Air is unable to eval gwt returned responses over a certain length, as
they are turned into arrays on the server. So we decode them if they
are this type...

// in your js file which is included...
String.prototype.endsWith = function (s) { return this.length =
s.length  this.substr(this.length - s.length) == s; }

function decodeGWT(s) {
if( ! s.endsWith(])) ) return s;
var end = s.indexOf(].concat();
var first = s.substring(0, end+1);
var second = s.substring(end+].concat(.length);
var arr = eval(first);
var middle = second.indexOf(],[);
var current = 0;
while( middle != -1 ) {
   var x = second.substring(current, middle+1);
   var arr2 = eval(x);
   arr = arr.concat(arr2);
   current = middle + 2;
   middle = second.indexOf(],[, middle+1);
}
var y = second.substring(current, second.length-1);
var arr3 = eval(y);
return arr.concat(arr3);
}

function parseGwtRpc(encoded){
return eval(decodeGWT(encoded));
}

If you need any help feel free to email me.

Joe

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-10 Thread nino ekambi
Why dont just use the RequestBuilder  and send  the response back as JSON or
XML ?

2010/7/11 Joe Cole profilercorporat...@gmail.com

 We have a very large app that uses air extensively (both online and
 offline modes). We had to jump through many hoops to get RPC working.

 For AIR compiles, we replace the following class with this method:

 public final class ClientSerializationStreamReader extends
 AbstractSerializationStreamReader {

private static native JavaScriptObject eval(String encoded) /*-{
   return $wnd.parseGwtRpc(encoded);
 }-*/;

 ... etc

 }

 Air is unable to eval gwt returned responses over a certain length, as
 they are turned into arrays on the server. So we decode them if they
 are this type...

 // in your js file which is included...
 String.prototype.endsWith = function (s) { return this.length =
 s.length  this.substr(this.length - s.length) == s; }

 function decodeGWT(s) {
if( ! s.endsWith(])) ) return s;
var end = s.indexOf(].concat();
var first = s.substring(0, end+1);
var second = s.substring(end+].concat(.length);
var arr = eval(first);
var middle = second.indexOf(],[);
var current = 0;
while( middle != -1 ) {
   var x = second.substring(current, middle+1);
   var arr2 = eval(x);
   arr = arr.concat(arr2);
   current = middle + 2;
   middle = second.indexOf(],[, middle+1);
}
var y = second.substring(current, second.length-1);
var arr3 = eval(y);
return arr.concat(arr3);
 }

 function parseGwtRpc(encoded){
return eval(decodeGWT(encoded));
 }

 If you need any help feel free to email me.

 Joe

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



GWT RPC with Adobe AIR 2

2010-07-09 Thread Gurufaction
How do you call GWT RPC from Adobe AIR? Is it possible? I get a
security violation from AIR.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: GWT RPC with Adobe AIR 2

2010-07-09 Thread Stefan Bachert
Hi,

GWT RPC is just an HTTP POST.
From this point of view it should be possible.
However, GWT RPC is passing an id in the headers which is changing
every compile.
So you must simulate this, too.

Stefan Bachert
http://gwtworld.de

On 9 Jul., 00:20, Gurufaction gurufact...@gmail.com wrote:
 How do you call GWT RPC from Adobe AIR? Is it possible? I get a
 security violation from AIR.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.