RE: Comments against Restlet 1.2M2
Hi Lars, I just changed it in SVN trunk as suggested. Hope you feel better now ;-) Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Lars Heuer [mailto:he...@semagia.com] Envoyé : jeudi 9 avril 2009 14:01 À : discuss@restlet.tigris.org Objet : Re: Comments against Restlet 1.2M2 Hi all, [...] Some comments against that release: [...] I like to add another point: Rename ServerResource#isExists to isExisting(). isExists hurts me. ;) It would make sense to rename setExists(boolean) as well. Best regards, Lars -- http://www.semagia.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=16176 53 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1687750
Re: Comments against Restlet 1.2M2
Hi all, [...] Some comments against that release: [...] I like to add another point: Rename ServerResource#isExists to isExisting(). isExists hurts me. ;) It would make sense to rename setExists(boolean) as well. Best regards, Lars -- http://www.semagia.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1617653
RE: Comments against Restlet 1.2M2
Hi guys, I agree with your remarks and did the following changes in SVN trunk: - RepresentationInfo is now concrete and has more constructors. - UniformResource#init() now throws ResourceException and catches it to update the response. - Renamed UniformResource#init() into doInit(). - Renamed UniformResource#destroy() into release(). - Added an UniformResource#doRelease() method. - ClientResource now overrides finalize() to call the release() method. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : David Fogel [mailto:carrotsa...@gmail.com] Envoyé : jeudi 2 avril 2009 20:28 À : discuss@restlet.tigris.org Objet : Re: Comments against Restlet 1.2M2 I also ran in to the issue of having a constructor that would throw a ResourceException if the request was bad in some way, and now the init() method doesn't declare any exceptions. Seems pretty reasonable to just add this. One other alternative would be to change ResourceException to be a RuntimeException subclass. This would allow any ServerResource annotated method to throw this exception without declaring it explicitly... -Dave Fogel On Thu, Apr 2, 2009 at 7:58 AM, Lars Heuer he...@semagia.com wrote: Hi all, First of all, I love the RepresentationInfo. :) Thanks for adding this. :) Some comments against that release: - I wonder how to create a RepresentationInfo since it is abstract; for the time being I created my own RepresentationInfo class derived from the abstract class. - Wouldn't it make sense to add a constructor RepresentationInfo(Variant variant, Date modificationDate) This constructor would add all information available from the variant (i.e. MediaType, Language etc.) to the RepresentationInfo plus the modification time. - Previously I used Resource(Context, Request, Response) in my derived Resource classes. This constructor is not available anymore in ServerResource. Not a big problem, though, even I have had to make my properties non-final, which is also not a big problem since Resources are not meant to be thread-safe. - Related to the above mentioned point, I allowed that my derived Resources throw an exception in the constructor. This was very convenient since Restlet automatically issued an error status. While moving my initialisation stuff to the ServerResource.init() method I recognised that init() does not allow to throw an exception, so I have to wrap my initialisation code in a try / catch block. I wonder if UniformResource#init() shouldn't be changed to protected void init() throws ResourceException; (or maybe Exception instead of ResourceException?) If an exception was thrown, Restlet 1.2 could handle it like Restlet 1.1 handled exceptions thrown by the constructor. Best regards, Lars -- http://www.semagia.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId =1518119 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=15224 23 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1533155
Re: Comments against Restlet 1.2M2
I also ran in to the issue of having a constructor that would throw a ResourceException if the request was bad in some way, and now the init() method doesn't declare any exceptions. Seems pretty reasonable to just add this. One other alternative would be to change ResourceException to be a RuntimeException subclass. This would allow any ServerResource annotated method to throw this exception without declaring it explicitly... -Dave Fogel On Thu, Apr 2, 2009 at 7:58 AM, Lars Heuer he...@semagia.com wrote: Hi all, First of all, I love the RepresentationInfo. :) Thanks for adding this. :) Some comments against that release: - I wonder how to create a RepresentationInfo since it is abstract; for the time being I created my own RepresentationInfo class derived from the abstract class. - Wouldn't it make sense to add a constructor RepresentationInfo(Variant variant, Date modificationDate) This constructor would add all information available from the variant (i.e. MediaType, Language etc.) to the RepresentationInfo plus the modification time. - Previously I used Resource(Context, Request, Response) in my derived Resource classes. This constructor is not available anymore in ServerResource. Not a big problem, though, even I have had to make my properties non-final, which is also not a big problem since Resources are not meant to be thread-safe. - Related to the above mentioned point, I allowed that my derived Resources throw an exception in the constructor. This was very convenient since Restlet automatically issued an error status. While moving my initialisation stuff to the ServerResource.init() method I recognised that init() does not allow to throw an exception, so I have to wrap my initialisation code in a try / catch block. I wonder if UniformResource#init() shouldn't be changed to protected void init() throws ResourceException; (or maybe Exception instead of ResourceException?) If an exception was thrown, Restlet 1.2 could handle it like Restlet 1.1 handled exceptions thrown by the constructor. Best regards, Lars -- http://www.semagia.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1518119 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1522423