actually, if your beans implement the Seriliazable interface (not only
IsSerializable) you can just use java's ObjectStream to get them on
wire. (look for short demo at
http://download.oracle.com/javase/tutorial/essential/io/examples/ObjectStreams.java
)

so your servlets would communicate over POST together where you wrap
the output/inputream (which you get from your HttpServletRequest /
HttpServletResponse) into the object stream and exchange your POJOs,
thats it. Note that you extend usual HttpServlet class rather than
GWT's RemoteServiceServlet and do your magic in the doPost() methods.

On 17 Nov., 16:31, Andrei Cosmin Fifiiţă <[email protected]>
wrote:
> Thx for the answers...
> I wanted to use serialization from the start but i really want to know how
> can i use JSON.
> BUT, i need to know if there is something simple that i can use (GWT, java,
> or other libs). For example, i have some java beans (with simple fields -
> string, integer, lists of those types...) and i want to
> serialize/deserialize them without modifying them. (widhtoug adding
> annotations, other methods, extending... or at least, very few
> modifications)
>
> On 17 November 2010 16:53, ep <[email protected]> wrote:
>
> > not sure if this will work outofthe box, since in GWT RPC there is
> > always a client which is initiating an RPC request first. so you have
> > to do so in your server code, except for there is nor XHR on the
> > server, the rest should work fine, especially serialization of the
> > request command, which you would pass from one servlet to another
> > using POST (not GET).
>
> > do you have to use HTTP beyond or would be be ok to use just tcp or
> > udp socket? I'd either go for RMI, binary serialization (no http) or
> > JSONP / XML (http) which you can easily get started with, of course
> > SOAPis the king^^ but I guess would be kinda overkill here.
>
> > On 17 Nov., 14:55, Greg Dougherty <[email protected]> wrote:
> > > Use Java Serialization to send the the objects from one servlet to
> > > another.
>
> > > Make sure you have the Objects implement Serializable.  :-)
>
> > > You can override doGet without damaging GWT RPC.  One servlet does
> > > that, the other (the one driving the exchange) makes an HTTP call to
> > > it.  They both use Object*Streams to send and receive the object(s).
>
> > > Greg
>
> > > On Nov 17, 6:52 am, Ice13ill <[email protected]> wrote:
>
> > > > Hello, I want to send objects between 2 servlets and i was wondering
> > > > if the GWT RPC mechanism used for client - server communication can
> > > > also be used to send data across two servlets that extend
> > > > RemoteServiceServlet.
>
> > > > Or maybe I can use the Java serialization to actually send bytes from
> > > > one servlet to another ?
>
> > > > Any ideas ?
>
> > --
> > 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]<google-web-toolkit%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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.

Reply via email to