I know how I can request a cross domain request from a gwt application to a grails action That's a wgt-plugin for grails, but development with this plugin is very slow (because I have to compile after every change in gwt-code). So I try to develop a separate living portion and get data from the grid application through AJAX request. But the live application is running on a different server (gwt: port 8888, Mile: Port 8080). If I try to request grails action then I get this error in the browser:
XMLHttpRequest http: // localhost: 8080 / MyApp / MyDomain / myAction can not load Genesis http : //127.0.0.1: 8888 is not allowed by access-control-permission I try to modify the feedback header in the grails action: < Pre> response.setHeader ('access-control-permission-origin', "http: //127.0.0.1:8888"); And if I work from a browser on top I can find:
Access-control-permission-origin: http: // 127.0 .0.1: 8888 But the problem is not resolved.
Update:
The solution is JSONP I GWT- My code on the site looks like this:
Private zero jsonp () {JsonpRequestbuilder jsonp = New JsonpRequestBuilder (); String url = "http: // localhost: 8080 / mypad / mymedman / mynection"; Jsonp.requestObject (url, new async callback & lt; javascript object & gt; () {@override public wide on Failure (Throwshell captcha) {} @override on public watch on seewes (JavaScript omback result) {}}); } and grails codes look like this:
def myAction = {deff result = MyDomain.findAll () "$ {params.callback} ( Thanks for Mic.
You can use, which is embedding the feedback in the JavaScript function, which will be asked when the file is loaded, and for example, a response might be something like this:
myCallbackFunction ('A string parameter', a page in your code In the form of SCRIPT tags. {Or: {a: json: 'data'}}, ...) And you have a function in your page: <
Comments
Post a Comment