RPC client part is not thought for java, although there are some libraries to handle it like gwt-syncproxy. Otherwise, RF can be used in any JVM like android, in fact request factory stuff is out of the gwt namespace.
I dont think trying to handle gwt-rpc with xcode is a good idea. What I do with my mobile apps is to use gwtphonegap, so as I can use the same code base for desktop and all devices, I have not to modify any line of code in my ajax code, I use RF or gquery-ajax, although rpc works fine as well. - Manolo On Tue, Oct 16, 2012 at 3:36 PM, Manikanda raj S <[email protected]> wrote: > Thanks for the Code Manolo. But i would also like to separate the code as > of now into GWT Client part as one and Servlet Part as other. One more > thing i want GWT Serialization externalized is, if we can have it > externalized, then we can probably use the same for Android Development > too.If we can convert the same to Objective C,we can use it for IPhone too. > I'm just trying to use GWT Serialization as a API data type with my Present > Code. > > > On Tuesday, October 16, 2012 6:01:39 PM UTC+5:30, Manuel Carrasco wrote: > >> Actually gwt RPC uses requestbuilder as its low-level transport, so cors >> works with rpc without any problem. >> >> Here you have an example of cors with gwt rpc. >> >> - In the client side you have to change the RPC service url >> GreetingServiceAsync greetingService = GWT.create(GreetingService.** >> class); >> ((ServiceDefTarget)**greetingService).**setServiceEntryPoint("http://** >> localhost:8888/mymodule/greet <http://localhost:8888/mymodule/greet>"**); >> >> - In the server side configure a filter in your web.xml >> <filter> >> <filter-name>corsFilter</**filter-name> >> <filter-class>com.example.**server.CORSFilter</filter-**class> >> </filter> >> <filter-mapping> >> <filter-name>corsFilter</**filter-name> >> <url-pattern>/*</url-pattern> >> </filter-mapping> >> - And this is an example of filter, maybe you should set any kind of >> security based on the Origin header >> >> package com.example.server; >> >> import java.io.IOException; >> >> import javax.servlet.Filter; >> import javax.servlet.FilterChain; >> import javax.servlet.FilterConfig; >> import javax.servlet.**ServletException; >> import javax.servlet.ServletRequest; >> import javax.servlet.ServletResponse; >> import javax.servlet.http.**HttpServletRequest; >> import javax.servlet.http.**HttpServletResponse; >> >> public class CORSFilter implements Filter { >> >> public void doFilter(ServletRequest servletRequest, >> ServletResponse servletResponse, FilterChain filterChain) >> throws IOException, ServletException { >> >> HttpServletRequest req = (HttpServletRequest) servletRequest; >> HttpServletResponse resp = (HttpServletResponse) servletResponse; >> >> String o = req.getHeader("Origin"); >> if ("options".equalsIgnoreCase(**req.getMethod())) { >> resp.setHeader("Allow", "GET, HEAD, POST, PUT, DELETE, TRACE, >> OPTIONS"); >> if (o != null) { >> resp.addHeader("Access-**Control-Allow-Origin", o); >> resp.addHeader("Access-**Control-Allow-Methods", >> "POST, GET, OPTIONS"); >> resp.addHeader("Access-**Control-Allow-Headers", >> "content-type,pageurl,x-gwt-**permutation,x-gwt-module-base"* >> *); >> resp.setContentType("text/**plain"); >> } >> resp.getWriter().flush(); >> return; >> } >> >> if (o != null) { >> resp.addHeader("Access-**Control-Allow-Origin", o); >> } >> >> if (filterChain != null) { >> filterChain.doFilter(req, resp); >> } >> } >> >> @Override >> public void destroy() { >> } >> >> @Override >> public void init(FilterConfig arg0) throws ServletException { >> } >> >> } >> >> The server part works with RPC, RF, RequestBuilder, gwtquery-ajax and any >> other js approach. >> >> - Manolo >> >> >> On Tue, Oct 16, 2012 at 9:01 AM, Thomas Broyer <[email protected]> wrote: >> > >> > >> > On Tuesday, October 16, 2012 8:58:49 AM UTC+2, Manikanda raj S wrote: >> >> >> >> CORS don't work with GWT Servlets, only with RequestBuilder. >> >>> >> >>> >> > >> > There's no reason it wouldn't work. What did you try? >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Google Web Toolkit" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/**msg/google-web-toolkit/-/**6FgCPqIoH6QJ<https://groups.google.com/d/msg/google-web-toolkit/-/6FgCPqIoH6QJ> >> . >> > >> > To post to this group, send email to google-we...@**googlegroups.com. >> >> > To unsubscribe from this group, send email to >> > google-web-toolkit+**[email protected]. >> > For more options, visit this group at >> > http://groups.google.com/**group/google-web-toolkit?hl=en<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 view this discussion on the web visit > https://groups.google.com/d/msg/google-web-toolkit/-/NrwwZIdQSVQJ. > > 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. > -- 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.
