One can use JSON libraries to deserialize json to POJO. How to do it with GWT?
GWT ships with Autobean framework. It allows you to serialize the json on client. But, we can use it on the server side too.
Here is the magic:
1) define the the interface which extends the AutoBeanFactory
2) on the server side use beanFactory = AutoBeanFactorySource.create(Your_Factory_class.class);
AutoBeanFactorySource is in com.google.web.bindery.autobean.vm.AutoBeanFactorySource package. One clue is that it is experimental. So check how it is working in your environment.
3) To decode json to POJO use:
AutoBean<Your_POJOInterface> bean = AutoBeanCodex.decode(
beanFactory, Your_POJOInterface.class, jsonString);
Your_POJOInterface requestObject = bean.as();
4) That is all! Just plain GWT and no other special mappers!
This blog is a collection of minds around linux, java, javascript, etc. Looking for great opportunities.
Показаны сообщения с ярлыком server side. Показать все сообщения
Показаны сообщения с ярлыком server side. Показать все сообщения
понедельник, 10 августа 2015 г.
вторник, 25 декабря 2012 г.
Server side browser detection
Recently, I've been faced with the task to detect user's devices browsers and redirect users to the different sites accordingly.
So, I've made a search and found out this script for HTTP server (http://detectmobilebrowsers.com/). This script detects many mobile browsers, even my old symbian E52 was detected.
IPad devices are not detected. It's up to you to decide weather should your users be redirected to the mobile versions of your site. So, the real problem for me is how to detect iPad mini?
Http user agent for iPad 2 and iPad mini are the same. You can check the blog here (http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent). If anybody can find the solution to this problem, please, share your knowledge.
So, I've made a search and found out this script for HTTP server (http://detectmobilebrowsers.com/). This script detects many mobile browsers, even my old symbian E52 was detected.
IPad devices are not detected. It's up to you to decide weather should your users be redirected to the mobile versions of your site. So, the real problem for me is how to detect iPad mini?
Http user agent for iPad 2 and iPad mini are the same. You can check the blog here (http://www.mobilexweb.com/blog/ipad-mini-detection-for-html5-user-agent). If anybody can find the solution to this problem, please, share your knowledge.
Подписаться на:
Сообщения (Atom)