Thursday, December 5, 2013

Re: JsonpRequestBuilder and Basic Authentication

There are two ways of using a proxy:

1.) The real proxy solution. You would install Apache2 or Nginx or anything else that can do HTTP proxying and configure an URL under your own domain that the proxy should map to the external server. In this solution there is no GWT / Java server involved. Your GWT client makes a request to https://app.yourdomain.com/rest/url along with basic auth headers and will get a result. The HTTP proxy however will forward the request of the GWT client to the external server, await its result and finally send the result back to your GWT client.
Thats pretty much the same technique you would use if you have multiple load balancers before your application servers that redirect all incoming requests to the application servers.

2.) Use a server you can run code on and kind of re-implement 1.). In terms of GWT a Java server would make sense but you are not forced to use one. If you use a Java server you could use anything GWT provides to talk to your server (GWT-RPC, RequestFactory, RequestBuilder, 3rd party libs). Once you have send all relevant information to your server, the server can do a new HTTP call to the external server.
With this solution you have a bit more control on how to request the data from your GWT client and you are also able to post-process the external data on your server before sending it back to your GWT client. You are able to hide the external service totally from the GWT client. 


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment