{"id":3398,"date":"2012-06-30T21:30:18","date_gmt":"2012-06-30T20:30:18","guid":{"rendered":"http:\/\/touk.pl\/blog\/?p=3398"},"modified":"2023-03-22T14:49:02","modified_gmt":"2023-03-22T13:49:02","slug":"english-gwt-rpc-serialization-problem","status":"publish","type":"post","link":"https:\/\/touk.pl\/blog\/2012\/06\/30\/english-gwt-rpc-serialization-problem\/","title":{"rendered":"GWT &#8211; RPC serialization problem"},"content":{"rendered":"<p><em>Type &#8216;some.type.you.are.sure.is.serializable&#8217; was not included in the set of types that can be serialized by this SerializationPolicy. For security purposes, this type will not be serialized.<\/em><\/p>\n<p>One of the most irritating problems that you will probably (sooner or later) have to deal with is GWT serialization policy (or serialization white list). Luckily there are at least 2 ways to work around this issue. Please read GWT documentation and this <a href=\"https:\/\/developers.google.com\/web-toolkit\/doc\/1.6\/FAQ_Server?hl=pl#Does_the_GWT_RPC_system_support_the_use_of_java.io.Serializable\" target=\"_blank\" rel=\"noopener\">FAQ<\/a> first! <\/p>\n<p>If GWT still fails to auto-detect your DTOs or other &#8220;go through the wire&#8221; objects serialization: <\/p>\n<p>1. Mark your &#8220;controversial&#8221; objects with com.google.gwt.user.client.rpc.IsSerializable interface This can be a little &#8220;ugly&#8221; if you want to keep your DTOs clean, without GWT related dependencies&#8230; but you can still hack it with<br \/>\n2. Define a new Dummy class with member fields of all types you want to include in serialization. Then add a method to your RPC interface:<br \/>\n  <em>Dummy dummy(Dummy d);<\/em> Add simple implementation:<br \/>\n  <em>Dummy dummy(Dummy d) { return d; }<\/em> And deal with async interface:<br \/>\n  <em>void dummy(Dummy d, AsyncCallback callback);<\/em> From now on the GWT compiler will have no problems with what is or what is not compatible with SerializationPolicy (credits for second solution to Andrej)<\/p>\n","protected":false},"excerpt":{"rendered":"Type &#8216;some.type.you.are.sure.is.serializable&#8217; was not included in the set of types that can be serialized by this SerializationPolicy. For&hellip;\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[71,28,68],"class_list":{"0":"post-3398","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-development-design","7":"tag-frontend","8":"tag-gwt","9":"tag-java"},"_links":{"self":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/3398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/comments?post=3398"}],"version-history":[{"count":12,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/3398\/revisions"}],"predecessor-version":[{"id":15507,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/3398\/revisions\/15507"}],"wp:attachment":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/media?parent=3398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/categories?post=3398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/tags?post=3398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}