Requestfactory: How to use Object?

122 views
Skip to first unread message

Manuel

unread,
Dec 25, 2016, 10:01:15 PM12/25/16
to GWT Users
Hi everyone,

I got a question regarding datatypes. I got a object on the server side that has a value of type Object. Like this:

class MyObject{
    public Object getValue();
    public void setValue(Object value);
}


How is it possible to have proxies for this object on the client side (with different datatypes (Date, String, Double, Long, etc.))? Object-Datatype is not allowed in proxies. Using a template-type is also not allowed. Is it somehow possible to have proxies for this object?

I guess I would like to have something like this:

@ProxyFor(value = MyObject.class)
MyDateObjectProxy{
    public Date getValue();
    public void setValue(Date value);
}

or

@ProxyFor(value = MyObject.class)
MyStringObjectProxy{
    public String getValue();
    public void setValue(String value);
}

Your help is much appreciated.

Kind regards,
Manuel

Ignacio Baca Moreno-Torres

unread,
Dec 26, 2016, 3:36:46 AM12/26/16
to GWT Users

Hi, a side note. IMO you should not start using request factory. It is a pretty awesome lib which solves a lot of problem which probably you don't have with the cost of a complexity which will make you ask a lot of doubt's like this one for a long time. IMO if you want a API focused in your model, with type inheritance, generics, etc. you should use GWT RPC. If you want a more message payloads focused API, you should use some REST lib like RestyGWT (mature, full java type support) or AutoREST (new, though to be used with JsInterop, do not support inheritance or other fancy things).


--
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-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Thomas Broyer

unread,
Dec 26, 2016, 9:11:35 AM12/26/16
to GWT Users
+1 Do not start learning/using RequestFactory (or even GWT RPC I'd say). Learn JsInterop and use json-based http APIs.

salk31

unread,
Jan 5, 2017, 9:01:04 AM1/5/17
to GWT Users
:(

Ignacio Baca Moreno-Torres

unread,
Jan 6, 2017, 7:11:35 AM1/6/17
to GWT Users

Hehe this is not a bad thing! Just means that now exists simpler solutions. I personally think that RF keeps track of object (the entity id) which add really a lot of complexity, at this point I think that the lib should include some kind of storage with remote synchronization because if not, the complexity just makes thing difficult with the "only" benefit of reducing transfer size. I also don't like the obscure encoding, not easy to debug, not compatible with changes in the model (sometimes). IMO RF was promising, but it's complexity do not justify its benefits. But the best thing to do is always an small project, and test each strategy, RF, RPC and Rest+Jackson, Rest+JsInterop. The last one has de benefit nowadays than is done almost everything in the browser natively without different code for different browsers.


--

Ed

unread,
Jan 6, 2017, 8:09:49 AM1/6/17
to Google Web Toolkit
I migrated everything from RPC to RF.  Thinking it was a better alternative to 3rd party libs and could be sustainable when 3.0 arrives was I wrong in this thinking?

Regards

On Fri, Jan 6, 2017 at 7:10 AM, Ignacio Baca Moreno-Torres <ign...@bacamt.com> wrote:

Hehe this is not a bad thing! Just means that now exists simpler solutions. I personally think that RF keeps track of object (the entity id) which add really a lot of complexity, at this point I think that the lib should include some kind of storage with remote synchronization because if not, the complexity just makes thing difficult with the "only" benefit of reducing transfer size. I also don't like the obscure encoding, not easy to debug, not compatible with changes in the model (sometimes). IMO RF was promising, but it's complexity do not justify its benefits. But the best thing to do is always an small project, and test each strategy, RF, RPC and Rest+Jackson, Rest+JsInterop. The last one has de benefit nowadays than is done almost everything in the browser natively without different code for different browsers.

El jue., 5 ene. 2017 15:01, salk31 <sal...@gmail.com> escribió:
:(


On Monday, December 26, 2016 at 2:11:35 PM UTC, Thomas Broyer wrote:
+1 Do not start learning/using RequestFactory (or even GWT RPC I'd say). Learn JsInterop and use json-based http APIs.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.

salk31

unread,
Jan 6, 2017, 8:38:53 AM1/6/17
to GWT Users
I can definitely see that it is complex (like compiler, garage collection, rdbms...) so it needs to outweigh that cost. My problem is that I really like UiBinder + Editor + RequestFactory and we have a large app built around this. I've been doing web for 25 years and it finally felt mature.

Do other frameworks offer anything to match the Editor framework setting fetch paths? (along with strong typing, compile time checks, batching requests, tracking deltas...)?



On Friday, January 6, 2017 at 1:09:49 PM UTC, Ed wrote:
I migrated everything from RPC to RF.  Thinking it was a better alternative to 3rd party libs and could be sustainable when 3.0 arrives was I wrong in this thinking?

Regards
On Fri, Jan 6, 2017 at 7:10 AM, Ignacio Baca Moreno-Torres <ign...@bacamt.com> wrote:

Hehe this is not a bad thing! Just means that now exists simpler solutions. I personally think that RF keeps track of object (the entity id) which add really a lot of complexity, at this point I think that the lib should include some kind of storage with remote synchronization because if not, the complexity just makes thing difficult with the "only" benefit of reducing transfer size. I also don't like the obscure encoding, not easy to debug, not compatible with changes in the model (sometimes). IMO RF was promising, but it's complexity do not justify its benefits. But the best thing to do is always an small project, and test each strategy, RF, RPC and Rest+Jackson, Rest+JsInterop. The last one has de benefit nowadays than is done almost everything in the browser natively without different code for different browsers.

El jue., 5 ene. 2017 15:01, salk31 <sal...@gmail.com> escribió:
:(


On Monday, December 26, 2016 at 2:11:35 PM UTC, Thomas Broyer wrote:
+1 Do not start learning/using RequestFactory (or even GWT RPC I'd say). Learn JsInterop and use json-based http APIs.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.

Thomas Broyer

unread,
Jan 6, 2017, 9:09:02 AM1/6/17
to GWT Users


On Friday, January 6, 2017 at 1:11:35 PM UTC+1, Ignacio Baca Moreno-Torres wrote:

Hehe this is not a bad thing! Just means that now exists simpler solutions. I personally think that RF keeps track of object (the entity id) which add really a lot of complexity, at this point I think that the lib should include some kind of storage with remote synchronization because if not, the complexity just makes thing difficult with the "only" benefit of reducing transfer size.


FWIW, that was the original design, in the first milestones of GWT 2.1. It was overhauled in the RC (too complex I believe, particularly when requesting partial objects, meaning that your "local cache" could have some properties that are out-of-date, breaking the "diff" requests).
 

I also don't like the obscure encoding,


Much less obscure than RPC ;-)
They allow entities to be referenced multiple times without duplication, including reference cycles.

not easy to debug, not compatible with changes in the model (sometimes). IMO RF was promising, but it's complexity do not justify its benefits.


I tend to agree. The main reason RF hasn't have more bugs fixed is that it's awfully complex (particularly on the server side) and hard to debug. I had floated the idea for years now to simplify things by generating code and relying less on reflection, but I'm not sure it'd be "compatible" with the ServiceLayer machinery.
 

But the best thing to do is always an small project, and test each strategy, RF, RPC and Rest+Jackson, Rest+JsInterop. The last one has de benefit nowadays than is done almost everything in the browser natively without different code for different browsers.


Most importantly, Web APIs put the complexity out of the code and into the protocol/API-design (to make it RESTful): they're super-easy to code on the both server (using Spring Web, JAX-RS, Restlet or RESTX) and client side (using JsInterop; which even allows your to share your objects –or interfaces– with the server)
If you're not too concerned with RESTful-ness and are happy with an RPC-style API, then JSON-RPC is quite easy to implement (and while RF can do JSON-RPC, it's not worth the complexity IMO)
And who knows, maybe one day we'll finally have grpc-web ;-)

Jens

unread,
Jan 6, 2017, 9:54:17 AM1/6/17
to GWT Users
And who knows, maybe one day we'll finally have grpc-web ;-)

Oh please! +1 

Ignacio Baca Moreno-Torres

unread,
Jan 6, 2017, 2:21:35 PM1/6/17
to GWT Users

Salk31, please note that we are saying that if you are going to start learning RF right now, you better try other approach. But as you said, RF, editor framework, probably validations, ui binder, etc is a pretty good solution. You should note that this solution is not going to evolve anymore (I think), but this again might be a good thing because hasn't evolved in the last 4 years and it is still a good solution. Actually I stop using RF when I stopped using editor framework. Both together is a good option.


El vie., 6 ene. 2017 15:54, Jens <jens.ne...@gmail.com> escribió:
And who knows, maybe one day we'll finally have grpc-web ;-)

Oh please! +1 

--

salk31

unread,
Jan 9, 2017, 3:58:49 AM1/9/17
to GWT Users
Thanks Ignacio,

Indeed. Our app will probably stay on the GWT 2.8 "branch" for a long time to come. Hopefully in that time something better will come along. We are mainly betting heavily on Java, JPA, lots of client side code... So hopefully won't be too painful a switch.

Cheers

Sam

On Friday, January 6, 2017 at 7:21:35 PM UTC, Ignacio Baca Moreno-Torres wrote:

Salk31, please note that we are saying that if you are going to start learning RF right now, you better try other approach. But as you said, RF, editor framework, probably validations, ui binder, etc is a pretty good solution. You should note that this solution is not going to evolve anymore (I think), but this again might be a good thing because hasn't evolved in the last 4 years and it is still a good solution. Actually I stop using RF when I stopped using editor framework. Both together is a good option.


El vie., 6 ene. 2017 15:54, Jens <jens.ne...@gmail.com> escribió:
And who knows, maybe one day we'll finally have grpc-web ;-)

Oh please! +1 

--
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+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages