Re: Explicit Access to GWT Serialization Logic
Thank you very much Xi, i will try your framework and will get to you if i need any help. On Thu, Nov 7, 2013 at 4:38 PM, Xi chenx...@gmail.com wrote: Hi, I've made a framework (*gwt-storage, * https://github.com/seanchenxi/gwt-storage) to realize the Object - String serialization/deserialization in client side, I *reused the RPC serialization/deserialization logic to do it*. You can check out the source code, (package *com/seanchenxi/gwt/storage/client/serializer*), maybe this can help you to find out your way. It's a pretty simple framework, the GWT RPC serialization/deserialization logic is asymmetrical between client and server, I just write a SerializationStreamWriter (more like a copy of *com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter*) for client side Object to String serialization, and I reused *com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader* to do client side deserialization. If you have any question, send me a mail. ;) Hope helpful ! Le mercredi 6 novembre 2013 10:59:42 UTC+1, Manikanda raj S a écrit : I have been using GWT RPC calls until now and it was really helpful. But now i wanted to split the Servlet part and Client Part of the GWT. Since GWT RPC is serializing the request and response data, i need to change them to XML/JSON in order to split the GWT code as client Servlet part or if i could gain access to Serialization logic, i could simply add some code to use 'RequestBuilder' and then explicitly serialize/deserialize in client servlet side. Marc Hacker already requested for the explicit access to the serialization logic, but he wasn't answered. Can anyone let me know how to access the serialize/deserialize classes in GWT. -- 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+unsubscr...@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.
Explicit Access to GWT Serialization Logic
I have been using GWT RPC calls until now and it was really helpful. But now i wanted to split the Servlet part and Client Part of the GWT. Since GWT RPC is serializing the request and response data, i need to change them to XML/JSON in order to split the GWT code as client Servlet part or if i could gain access to Serialization logic, i could simply add some code to use 'RequestBuilder' and then explicitly serialize/deserialize in client servlet side. Marc Hacker already requested for the explicit access to the serialization logic, but he wasn't answered. Can anyone let me know how to access the serialize/deserialize classes in GWT. -- 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+unsubscr...@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.
Re: GWT Serialization
CORS don't work with GWT Servlets, only with RequestBuilder. As i said before i want to be able to separate the client and server code to two different web servers. And i don't want to be redoing my code all over again. Besides GWT's Serialization seems to be pretty Good. So Why replace it , just i'm trying to use it in a different way, that's it. On Tuesday, 16 October 2012 11:28:56 UTC+5:30, Manuel Carrasco wrote: So, I dont follow you. If you want to generate serialized strings in server side, you have to maintain the dependence with gwt rpc there, so why dont continuing using rpc-servlets, actually they serialize/deserialize to strings, and the same in the client side. As you say CORS works well with RPC. What is the goal of replacing gwt-rpc servlets by your own ones, or to use directly requestbuilder ? On Mon, Oct 15, 2012 at 8:35 PM, Manikanda raj S sls...@gmail.comjavascript: wrote: Hi Manolo, Thanks for the links. But i have been using GWT RPC in my Application for quite some time and it would be a pretty big work to migrate all those from GWT-RPC Serialization to Autobeans or json databinding. That's why i specifically asked for GWT Serialization externally. Any ideas on Externalized GWT Serialization ..? On Monday, 15 October 2012 12:35:49 UTC+5:30, Manuel Carrasco wrote: What you want is easy to do using requestbuilder + autobeans. Autobeans are thought to handle json string representations and convert them to javaobjects, they work in server and client sides and are full testable. http://code.google.com/p/gwt-**autobean-binding/http://code.google.com/p/gwt-autobean-binding/ http://code.google.com/p/**google-web-toolkit/wiki/**AutoBeanhttp://code.google.com/p/google-web-toolkit/wiki/AutoBean Another option I use very often in client side because of its simplicity and performance is gwtquery ajax + json-databinding http://code.google.com/p/**gwtquery/wiki/Ajaxhttp://code.google.com/p/gwtquery/wiki/Ajax http://code.google.com/p/**gwtquery/wiki/DataBindinghttp://code.google.com/p/gwtquery/wiki/DataBinding In both cases you can use any json backend. - Manolo On Sat, Oct 13, 2012 at 12:35 PM, Manikanda raj S sls...@gmail.comwrote: I'm using GWT RPC Calls for Server Side Request so far and it's pretty good. I'm planning on separating my Code into Servlets and GWT Client Side. Since i'm using RPC calls, it seems impossible. The Reason i want to do like this is , i'm planning to provide white labeling option for my App. So if i could separate the code to client code and servlets, i can simply provide the White Labeled client code to my Partners to host on their server. I have checked with GWT RequestBuilder and 'Access-Control Allow-Origin : Origin from Client Header' and it works fine. However i need to implement gwt-serialization over RequestBuilder request and Servlet Responses. How can i do this ..? Things I like to make: - RequestBuilder sending Serializable String(Which is a * IsSerialiazible* object) to Servlet. - Servlet deserializes the String to Java Object,Processes and Returns the String Response of a '*IsSerialiazable*' (Another) Object. - The Response String received in GWT RequestBuilder deseriailizes it back to a Java Object(JS after Compiling). -- 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/-/**ZNwK3SwtKOUJhttps://groups.google.com/d/msg/google-web-toolkit/-/ZNwK3SwtKOUJ . To post to this group, send email to google-we...@**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=enhttp://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/-/Pfw2FLUTfxoJ. To post to this group, send email to google-we...@googlegroups.comjavascript: . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. 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 view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4NdTh26QSj0J. To post to this group, send email to google-web-toolkit@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 Serialization
How can i actually set Response Headers in GWT Servlets ..? If i can have normal Servlets, i can have a Filter doing that. Besides i want to run client and server code in different webservers, client code(Java Script,HTML) in a apache servers in my customer's location and Servlets in my own Server. How can i do that with gwt-rpc servlets ...? On Tuesday, October 16, 2012 12:31:43 PM UTC+5:30, Thomas Broyer 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/-/5d0gx8dvzyUJ. To post to this group, send email to google-web-toolkit@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 Serialization
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:/mymodule/greet;); - In the server side configure a filter in your web.xml filter filter-namecorsFilter/filter-name filter-classcom.example.server.CORSFilter/filter-class /filter filter-mapping filter-namecorsFilter/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 t.br...@gmail.comjavascript: 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. To post to this group, send email to google-we...@googlegroups.comjavascript: . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. 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 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 google-web-toolkit@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 Serialization
Thanks Guys, it's been really a lot of help here. I will definitely try these things. On Tuesday, October 16, 2012 8:20:02 PM UTC+5:30, Jens wrote: Correct me if I am wrong. You have a GWT application up and running on your application server (jetty, tomcat, or similar) and now you want to move your compiled app (HTML/Javascript) to an external web server on a different domain/host. To do so you have two options: 1.) Enable CORS on your server using a servlet filter that sits in front of your GWT-RPC server services. Only downside is that CORS does not work with IE6 and IE7 at all and it only works on IE8 / IE9 if you use the XDomainRequest object instead of XMLHttpRequest. Not sure if GWT's RequestBuilder (that is used by GWT-RPC internally) already handles this ( http://caniuse.com/#search=CORS) 2.) Most likely you can configure the external web server to proxy specific URL requests to your server. That means when your GWT app makes a GWT-RPC request to http://customerdomain.com/app/service , the web server can internally redirect the request to http://yourserver.com/app/service. In that case you don't need CORS because your GWT client side app doesn't even know that the data comes from your server. If you want 3rd party developers, Android/iPhone apps accessing your server, you should really think about *adding a new API* to your server that does not depend on GWT. Your GWT app can still use GWT-RPC so you dont have to rewrite it. A common way to do so ist to provide *an additional REST API using JSON/XML* that can easily be used by different non-GWT clients. That way you don't have to rewrite all the GWT serialization code for your non-GWT clients (Android/iPhone) and you don't have any trouble if you want to upgrade your GWT app to a newer GWT version (this could break GWT serialization of non-GWT clients if GWT internals have changed and your GWT serialization library, in lets say Objective-C, does not reflect these changes yet. So you need to update these non-GWT apps as well. You dont want that.). Personally I found flatpack-java promising ( https://github.com/perka/flatpack-java). Hope this helps and I have understood you correctly. -- J. -- 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/-/cQtKHVKCAr8J. To post to this group, send email to google-web-toolkit@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 Serialization
Hi Manolo, Thanks for the links. But i have been using GWT RPC in my Application for quite some time and it would be a pretty big work to migrate all those from GWT-RPC Serialization to Autobeans or json databinding. That's why i specifically asked for GWT Serialization externally. Any ideas on Externalized GWT Serialization ..? On Monday, 15 October 2012 12:35:49 UTC+5:30, Manuel Carrasco wrote: What you want is easy to do using requestbuilder + autobeans. Autobeans are thought to handle json string representations and convert them to javaobjects, they work in server and client sides and are full testable. http://code.google.com/p/gwt-autobean-binding/ http://code.google.com/p/google-web-toolkit/wiki/AutoBean Another option I use very often in client side because of its simplicity and performance is gwtquery ajax + json-databinding http://code.google.com/p/gwtquery/wiki/Ajax http://code.google.com/p/gwtquery/wiki/DataBinding In both cases you can use any json backend. - Manolo On Sat, Oct 13, 2012 at 12:35 PM, Manikanda raj S sls...@gmail.comjavascript: wrote: I'm using GWT RPC Calls for Server Side Request so far and it's pretty good. I'm planning on separating my Code into Servlets and GWT Client Side. Since i'm using RPC calls, it seems impossible. The Reason i want to do like this is , i'm planning to provide white labeling option for my App. So if i could separate the code to client code and servlets, i can simply provide the White Labeled client code to my Partners to host on their server. I have checked with GWT RequestBuilder and 'Access-Control Allow-Origin : Origin from Client Header' and it works fine. However i need to implement gwt-serialization over RequestBuilder request and Servlet Responses. How can i do this ..? Things I like to make: - RequestBuilder sending Serializable String(Which is a * IsSerialiazible* object) to Servlet. - Servlet deserializes the String to Java Object,Processes and Returns the String Response of a '*IsSerialiazable*' (Another) Object. - The Response String received in GWT RequestBuilder deseriailizes it back to a Java Object(JS after Compiling). -- 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/-/ZNwK3SwtKOUJ. To post to this group, send email to google-we...@googlegroups.comjavascript: . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. 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 view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Pfw2FLUTfxoJ. To post to this group, send email to google-web-toolkit@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 Serialization
I'm using GWT RPC Calls for Server Side Request so far and it's pretty good. I'm planning on separating my Code into Servlets and GWT Client Side. Since i'm using RPC calls, it seems impossible. The Reason i want to do like this is , i'm planning to provide white labeling option for my App. So if i could separate the code to client code and servlets, i can simply provide the White Labeled client code to my Partners to host on their server. I have checked with GWT RequestBuilder and 'Access-Control Allow-Origin : Origin from Client Header' and it works fine. However i need to implement gwt-serialization over RequestBuilder request and Servlet Responses. How can i do this ..? Things I like to make: - RequestBuilder sending Serializable String(Which is a *IsSerialiazible*object) to Servlet. - Servlet deserializes the String to Java Object,Processes and Returns the String Response of a '*IsSerialiazable*' (Another) Object. - The Response String received in GWT RequestBuilder deseriailizes it back to a Java Object(JS after Compiling). -- 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/-/ZNwK3SwtKOUJ. To post to this group, send email to google-web-toolkit@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.