I'm probably misunderstanding your question, but here goes: You can't
really "send" objects in Restlet, you can only send representations. The
client resource proxy machinery makes it look as though you are sending an
object by calling a method that looks like the target method on the server
side, but in reality, it serializes the object (using Java serialization by
default) into bytes, and the server deserializes those bytes at the other
end.

There are several problems with the default use of Java serialization, the
biggest of which is that it limits client and server to being Java
programs, both compiled with the same represented types. (It's also
annoying to have to make everything java.io.Serializable.) If that isn't a
problem for you, then you're set, apart from having to get the details
right. I can't help you with those details beyond the suggestion I've
already made.

If the Java-only approach is too restrictive, then you can use alternative
serialization. What has worked very well for me is Jackson, which
eliminates the java.io.Serializable requirement and supports two
lower-level serialization formats: JSON and Smile, the latter being a
binary analogue of former. (Jackson also has growing support, via add-on
projects, for other serialization formats, like XML and CSV.)

With Jackson, I can have serve *and accept* JSON representations of my Java
data types. My clients are not limited to Java programs.

I can't point you to a simple example of how to accomplish this, though
I've written about various aspects of the process in this discussion group
and on my blog. The only advice I can give is to look at existing examples,
see how they work, and adapt them to your needs.

--tim

On Tue, Apr 10, 2012 at 10:02 AM, Sultan Kosaev <s.u....@mail.ru> wrote:

> Alright. But for example, when you want to send an object of any class of
> the
> server, how do you do it? Through Serializable interface? Or how?
> For example, you can tell me the link, the book and i had read about it. I
> just don't know where i can still read about restlet, except book "RESTlet
> in the Action"
>
> Give mt any ideas. Because I do not know what to do, where to read....
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/How-send-object-from-client-to-server-tp7451974p7452965.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2946871
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2946897

Reply via email to