How do I avoid using an async class when using gwt dto? - gwt

Can anyone please explain how I can avoid using an aync class when using dto to serialize an object in a service?

If I understand your question, DTOs are only for passing data to the client side in a GWT application, when you can't pass the server side object directly. DTOs have nothing to do with the async classes, which the GWT compiler needs for RPC service calls.

Related

Is it ok to pass entity objects in post method requestbody?

I have a Springboot Rest project. Suppose I have User class as entity. Is it ok to pass this entity object directly in the RequestBody of a POST method? My funcionality will work smoothly with this. My question is , whether it is a security flaw? If yes what is the solution?
This will work fine and is an easy implementation but architecturally this isn't a good practice because this tightly coupling your rest implementation with your database design and exposing it to the consumer of the API.
You should have request/response objects coming into your api and going out of it decoupling it from the database and allowing you to perform validations and other business rules at a layer above data access. If you find you are having to write a lot of assignment code between the entity and dtos then you can use a tool like http://modelmapper.org/ or http://mapstruct.org/

Send serialized object from server to GWT

I'm looking for a easy way to send a custom class from an ActionBean response to a GWT client.
Can someone help me with a easy and concret example how to do this.
Thanks in advance
You should probably use RequestFactory as it does not require that the bean be serializable as the GWT RPC service does. You would create a value proxy on the client side and make sure it maps getters/setters that you need.
https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory

gwt serialize and de-serialize object from and to a string (client side only)

I have java objects used in GWT RPC calls. On the GWT client I need to store these objects in a web sql database. I need to be able to convert these objects to a string and then also de-serialize them from the string. I have seen many aproaches JSON, AutoBean, various other libraries but none seem to be able to handle circular references which I do have in my objects.
Anyone know of a GWT library that can handle my requirements?
GWT RPC itself transmit responses to the client using JSON and handles circular references okay (at least I think so) - So I cannot see why this mechanism cannot be re-used. Any ideas?
If the Web SQL service conforms to JAX-RS or Jackson JSON, use RestyGWT.
There is no conversion necessary on your part. RestyGWT encodes your POJOs to Jackson-compliant JSON.
The flip-side is you would have to read up on JAX-RS, JAXB, Jackson annotations. Which is not a flip-side to me but an exciting opportunity to learn a widely used web service technology.
GWT RPC itself transmit responses to the client using JSON
that is an inaccurate perception.
GWT RPC object encoding is deliberately obfuscated and difficult to decipher and format stability is not guaranteed from version to version.
there is no json in the RPC data interchange.
If your statement were true, then you would not have needed a servlet that extends GWT RemoteServiceServlet to service a RPC request.
BTW, what web SQL service is that? Proprietary in-house?

How do I send GWT JavaScriptObjects through RPC?

I have several GWT Maps API JavaScriptObjects (LatLng, Polyline) which I want to send between the client and the server with RPC but becouse they aren't serializable I can't use them. Currently I have Pojos for RPC communication and I mirror them into their JavaScriptObject twins on the client side...
Is there any way to do send these objects through? I have the feeling I'm missing something about how should I do this.
JavaScriptObjects are not real Java objects, so while they work in dev mode and when compiled to JavaScript, they can't work in a standard JVM, not connected to a browser. So no, you can't send the JSO to the server over RPC. A standard JVM won't even be able to load the class, since a JSO will have native methods, and the JVM won't have proper implementations of those methods.
If you can control the JSO, you might make both it and your POJO implement a common interface. For Maps API, you probably don't control it - a thought there could be to serialize the objects to JSON strings and just send those to the server. If the server then needs to read out the data, you might use Gson, Jackson, json.org, etc to read the data in those JSON strings.

Use pojo as gwt RequestFactory proxy instead of interface

Is there any easy way to use a pojo as a request factory proxy and not an interface? The case is that I would like to reuse the actual value object as is without creating an interface describing it.
I do not that this can not be done out of the box. GWT fails to compile with an error regarding non getter/setter methods insite the "proxy" class.
This not possible, by design. See this previous StackOverflow answer.