Hi Hugh,

You basically want to check the media type of the incoming representation
and depending on it do the necessary validation/extraction/etc.

For the other steps, it heavily depends upon your persistence strategy and
the technologies you select.

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Richard Hoberman [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 14 octobre 2008 09:43
À : [email protected]
Objet : Re: Best practices when Implementing acceptingRepresentations?

Hi Hugh

Hugh Acland wrote:
> Richard Hoberman <richard.hoberman <at> sadalbari.com> writes:
>
>   
>> 2.  POJO
>>
>> Deserialize representation into POJOs, directly from JSON or XML as
>> appropriate.  This avoids working with XML directly, but requires an
>> extra data model (the legacy business layer uses POJOs annotated for
>> Hibernate, but I want to decouple the REST layer from the business
>> layer, so I'd have to duplicate the data model to some extent)
>>     
>
> Hi Richard,
>
> Not sure what you are asking exactly but you mention hibernate and POJOs.
So 
> this might be way off the question but are you familiar with db4o?
>
> http://www.db4o.com/
>
> Persist the object, fetch the object. No more data layers! I am a big fan
of 
> object persistence.
>
>   
Thanks for your reply. I'll try to make my question clearer.

The steps for processing a PUT/POST are:

1. Validate the incoming representation (incl. business rules)
2. Retrieve the relevant objects from the data layer (or create new ones)
3. Update the data object
4. Persist the changes

I'm wrapping a REST service around an existing system so I have no
influence over step 4 (Hibernate/MySQL). I'm interested in how people
are handling steps 1 - 3, particularly when they are supporting more
than one variant of representations (e.g. JSON and XML).

Richard

Reply via email to