Hi David,
Ive just updated the Javadocs of @Post and @Put to clarify the design choice. Sorry for the trouble. Best regards, Jerome Louvel -- Restlet ~ Founder and Technical Lead ~ <http://www.restlet.org/> http://www.restlet.org Noelios Technologies ~ <http://www.noelios.com/> http://www.noelios.com De : Jerome Louvel [mailto:[email protected]] Envoyé : lundi 12 juillet 2010 14:32 À : discuss Objet : Re: Breaking change in AnnotationInfo, effecting all our annotated @Post methods with no params Hi David, I understand the trouble and will at least improve the Javadocs of @Post and @Put to mention this extra constraint. This change was made (late in the dev process I agree) to clarify the situations where several @Post annotations are defined for the same interface/resource and we need to select the best one based on the entity media type. Also, if we want to be able to reuse the interfaces on the client side, then an input parameter that will get converted to an entity is necessary (unless there is no entity for the POST method in which case we allow the lack of input parameter). This was close to an API design bug from my point of view, hence the late change. On the positive side, the adjustment for existing code should be really simple in all cases. For you, just do this: @Post public void handleSomePost(Form form) { doSomethingWithAForm(form); ..... } Best regards, Jerome 2010/7/12 David Fogel <[email protected]> Hi Jerome- We just updated to trunk (revision 6751), and many of our annotated @Post methods in our application have stopped working! Based on commit comments, the relevant changes are sometime in the last 24 hours (revisions 6744 and 6745) made to AnnotationInfo.java, where your comment was: - When selecting an annotated method, if the request has an available entity, now the Java methods without an input parameter are rejected. Throughout our current project, we have many annotated methods that look like this: @Post public void handleSomePost() { // <-- note no params doSomethingWithAForm(new Form(getRequest().getEntity())); ..... } This has worked fine for us throughout most of the 2.0 process, and I haven't seen any documentation that prohibits this. While I understand the logic behind @Post methods taking a single parameter representing the request entity body, it's not at all obvious that a Post handler without any params should be considered incompatible with a request that contains an entity. Additionally, it seems late in the game to change this logic- although if it turns out that we're the only people using this pattern, then we can certainly make the adjustment- but I'd recommend documenting the annotation-processing very thoroughly, especially for this case. Thanks, -Dave Fogel ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2632 190> &dsMessageId=2632190 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2634662

