Hi Nico, Here is the process:
- create a subclass of ConnectorService - override the afterSend(Representation) method - test the representation instance against your base MyRepresentation class - cast it to your MyRepresentation class and invoke your commit/rollaback logic I would however recommend to use the ServerResource#onSent callback mechanism instead as it will be easier to use, especially if you rely on automatic bean <-> representation conversion and Restlet annotations. Best regards, Jerome 2010/4/28 Nico Van Cleemput <nico.vancleem...@gmail.com> > Hi Jerome > > Thanks for your pointers. If it isn't obvious, I'm quite new to this > framework (and actually I'm just an amateur who is also new to web > applications ;-)). I also need to apologize, because after searching a bit > more I noticed that there was already a similar question in this list about > a year ago. > > I do have a follow-up question. Is there somewhere some example code on how > this could be achieved? More specific I'm struggling with the following: if > I create my DAO and start the transaction in doInit() of UniformResource, > then how do I get a reference to it in ConnectorService, so I can commit or > rollback in afterSend? > > Just let me finish by giving you some more praise. ;-) The framework looks > really good, but at the moment it still a bit opaque. I'm looking forward > your In Action book and hope that you describe somewhere the steps that are > taken from when a request enters the frameworks to when the response > leaves, > because I still have the feeling I'm missing a lot of the details. (or if > you already have a blogpost or something like that describing that in > detail, you may always point me in the right direction ;)) > > Kind regards, > Nico > > > jlouvel wrote: > > > > Hi Nico, > > > > UniformResource has two methods, doInit() and doRelease() that can be > used > > for this. However, be careful with your transaction strategy if your > > representations need access to the DAO at writing time (after > > afterHandle() > > is called, in the connector).You can used ServerResource#onSent callback > > for > > this or the ConnectorService#afterSend method. > > > > Best regards, > > Jerome Louvel > > > > -- > View this message in context: > http://restlet-discuss.1400322.n2.nabble.com/Restlet-and-DAO-tp4962381p4972782.html > Sent from the Restlet Discuss mailing list archive at Nabble.com. > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2597753 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2597819