Yes that's possible, however, to my knowledge, only with Jetty's JSON library.
Here is a test that shows how you should do it:
https://github.com/cometd/cometd/blob/master/cometd-java/cometd-java-server/src/test/java/org/cometd/server/ServiceWithCustomDataClassTest.java
The key things are:
1. Create and use a JettyJSONContextServer subclass, so that you can
call getJSON() on it (lines 35 and 121)
2. Add a JSON.Convertor to the JSON object you got on step 1 (line 48)
3. In your JavaScript, add the "class" field in the data object,
containing the class that you want to deserialize to in the server.
(line 67).
Alternative to 2, you can have your DTO class implement JSON.Convertible.
I could not do this with Jackson.
Simon
--
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
Thanks for sharing !
You do not need to subclass BayeuxServerImpl. Just do 3. in a message
listener on server.
You can modify the message inside message listeners, and that's fully
portable because it's based on the API, not the implementation.