I've had a long-poll implementation using gwt for a long time now. It
defers the response until either an update or a timeout occurs. It works
well, but it uses both a socket (inexpensive) and a thread (expensive), so
I'd like this to use the async requests introduced in servlets 3.0. I've
used async requests in non-gwt servlets and it's worked well.
In GWT however, once I've deferred the response, I can't figure out how to
serialize the the response object once it's ready. For example, say I have
this gwt-rpc method:
public String longpoll()
Once inside I can defer the response with:
getThreadLocalRequest().startAsync();
But once I'm ready to complete the response how is that String response
serialized and returned (since I am no longer in the scope of the longpoll
method)? (Note that the String response is just an example, in my case it's
actually a custom object.)
Looking at the API for RemoteServiceServlet I don't see anything useful,
except the onAfterResponseSerialized
<https://docs.sencha.com/gxt/4.x/javadoc/gwt-2.8.0/gwt-2.8.0/com/google/gwt/user/server/rpc/RemoteServiceServlet.html#onAfterResponseSerialized-java.lang.String->
(String
<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true>)
which I can probably figure out how it works to come up with my own
serialization, but this seems dangerous.
I think more generally my question is: is there any way to manually
serialize an object and send it out with the response object? I think if I
knew that then it would solve all my problems.
Thanks!
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.