Il giorno 23/gen/2013, alle ore 09.54, Francesco Chicchiriccò ha scritto:
> On 23/01/2013 09:06, Jan Bernhardt wrote: >> Hi Syncoper, >> >> here are the proposed changes for our Configuration Service: >> >> * Changing Create response type to javax.ws.rs.core.Response. This way we >> can set response HTTP Status code (201 created) without requiring >> HttpServletResponse as method parameter. Also according to best RESTful >> practices instead of returning newly created object directly, only URL for >> new Object (Configuration) will be returned. Console does not even care >> about created response, thus network traffic can be reduced, by not sending >> object (configuration). If consumer does care about new object he can easily >> follow provided URL (in response) and retrieve new object. > > If this is a REST best practice, fine for me. > >> * Changed ModelAndView response type to Set<ValidatorTO> / >> Set<MailTemplateTO> and introduced wrapper TO classes for ValidatorTO and >> MailTemplateTO. > > Fine. > >> * Changed return type from update() and delete() to void, since console >> does not even care about it, and I think this should be best practice >> anyway, since consumer knows updates object already and does not care about >> deleted ones, therefore there is no need to send them over the network. > > About update() I can agree with you: since the updated entity (user, role, > ...) is still there, an URL can be returned as in the create() case reported > above. > > About delete() however, not retuning the deleted entity can break the current > feature: once again, please don't think that the admin console is the only > REST client out there. +1 The response provided by the delete is also used to know the outcome of the deletion performed onto the external resources. > Regards. > > -- > Francesco Chicchiriccò > > ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member > http://people.apache.org/~ilgrosso/ >