Thursday, March 3, 2016

Re: Interaction between application deployed in two different domain in GWT

CORS won't help here: you're apparently trying to communicate between browsing context (iframes) of different origins. To do that, you need to use postMessage: http://caniuse.com/#feat=x-doc-messaging
If you're trying to use a FormPanel to send a form to your other app, then you'd have to redirect to a page from your "first" app.
If you don't need to support IE9 and IE8 (which are no longer supported by Microsoft since January), you should IMO rather use XMLHttpRequest with FormData: http://caniuse.com/#feat=xhr2 (easy migration path: cancel normal form submission, create FormData from form, send it with XMLHttpRequest, which respects CORS, and process the request –get it as a document and retrieve the innerHTML of the body so you don't even have to change your servlet code–; no other change to the widgets needed)

On Thursday, March 3, 2016 at 8:04:56 AM UTC+1, abdul wrote:
I have an application which contains the UI code created as WAR (GWT application) and server side code as EAR deployed in two different domains(8080,9090) respectively. While communicating from 8080 to 9090 its sending a request and even i can see its returning the response 200. But the client is throwing some GWT exception *"Permission denied to access property 'document'* ".Below image shows the exception thrown in fire bug.



Note: i have enabled the CORS in server 9090 see the below code added in server side code EAR

    @Override
    public void doFilter(ServletRequest arg0, ServletResponse arg1,
    FilterChain arg2) throws IOException, ServletException {
    
   
    HttpServletRequest request=(HttpServletRequest) arg0;
   
    HttpServletResponse response=(HttpServletResponse) arg1;
   
    response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
   
    arg2.doFilter(request, response);
    }


Is there any think i need to add in GWT client UI to handle this exception.Any suggestion ?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment