I don't want to allow the client to modify the self or edit link. To protect the integrity of the entry, I want the server to set the fields that its responsible for to ensure the data is valid. This would cover fields like: edited, modified, created, id, and some of the links. I wanted the server to set the links that it is responsible for to ensure they are valid and that some nefarious client didn't mess with the links.
So, my original plan was to check for the presence of the 'self' and 'edit' links in the entry that was PUT to the server. If those links existed, I wanted to remove them and then add a new server generated link. I would leave 'alternate' links intact because the client should be able to provide alternate forms that the server knows nothing about. I wanted to have the server modify the instance of Entry that was received in the putEntry method, and then return that entry back to the client. I was hoping to avoid creating a new instance of Entry and copying all the fields from one instance to the other. This seemed to point to a shortcoming of the API which could be solved by having a ''removeLink" method similar to the 'addLink' convenience method. I know this problem can be solved by iterating through the list of Links and modifying the href based on the rel value. I attempted to get the list using 'getLinks" and remove the link from the returned list, but that produced an error. I suggest adding a 'removeLink' convenience method. > ---------- Forwarded message ---------- > From: "David Calavera" <[EMAIL PROTECTED]> > To: [email protected] > Date: Tue, 22 Jul 2008 17:19:48 +0200 > Subject: Re: Entry Replace Link > From my point of view links shouldn't be modified by the client and you > should ignore what the client is sending you in that elements. Think that > the proper entry is given by the url that the server receives and the edit > link is there in order to the client knows where it can request the entry > operations. > > Can you explain your app a little? Why do you allow the client could modify > the edit link? > > On Tue, Jul 22, 2008 at 4:36 PM, pdk <[EMAIL PROTECTED]> wrote: > >> I'm receiving an entry via a PUT and would like to return the updated entry >> to the client. My idea is to read the entry, update some of the fields >> (updated time), validate other fields, persist to db, then return the >> updated entry. >> >> One of the fields that I want to validate is the 'self' and 'edit' links. >> I >> want to ensure that the links are still in the entry and that they point >> back to the proper entry. However, I don't see a method that will allow me >> to remove or replace a link from the Entry. >> >> Is there a way to do this other than creating a new entry and copying field >> by field? >> >> Thanks, >> philip >> > > > > -- > David Calavera > http://www.thinkincode.net > >
