Hi Mark - I've actually gotten this partially working since we last talked. I can't use a RemoteServiceServlet because the GWT-RPC mechanism is based on XHR which is restricted by SOP. I'm writing my own custom transport layer using JSONP, but I still want to be able to use java objects to transfer data, so I want to be able to serialize / deserialize these objects so I can send them over jsonp.
Is there a way to use RemoteServiceServlet and still get around the SOP that I'm unaware of? -Andrew On Mon, Jun 1, 2009 at 4:29 PM, Mark Renouf <[email protected]> wrote: > > Can you eloborate on your goals (re: cross-site)? I'd like to > understand the motivation so I can comment on the approach. Obviously > there is a reason why cannot make use of RemoteServiceServlet, but I'm > not sure I know why. > > On Jun 1, 3:41 pm, mayop100 <[email protected]> wrote: > > Hi Guys - > > > > I'm trying to write my own custom transport solution for client / > > server communication so that I can make my project work cross-site. I > > would like to serialize objects on the client side, send them to my > > Jetty server using my own custom transport, and then deserialize those > > objects on the server side for handling. > > > > I've written the client code, and it seems to be working. It looks > > like this: > > (not that NetworkPacket implements IsSerializable, and EventService is > > a dummy RemoteService) > > > > public String serializePacket(NetworkPacket np) > > { > > String retVal = null; > > > > SerializationStreamFactory fact = > (SerializationStreamFactory) > > GWT.create(EventService.class); > > SerializationStreamWriter theSW = > fact.createStreamWriter(); > > try > > { > > theSW.writeObject(np); > > retVal = theSW.toString(); > > } > > catch(Exception e) > > { > > e.printStackTrace(); > > } > > > > return retVal; > > } > > > > This code seems to be working (it produces a reasonable-looking > > string). I can't test if it deserializes though because the > > serialization is asymmetric. The part I can't figure out though, is > > how to deserialize on the server side. The closest I've found is the > > ServerSerializationStreamReader class, which I found while poking > > through the GWT source. It seems to be undocumented though, and its in > > the "com.google.gwt.user.server.rpc.impl" package, which tells me it's > > probably not intended for use by my code. How am I supposed to do > > this? > > > > Any help will be greatly appreciated! > > > > -Andrew > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
