RE: Re: post in putUser Bookmark throws error
yes...it does not have acceptrepresentation method. But then why it has been implemented as PUT rather than POST? User creation should always be POSt, right? PUT is always used for Updates, right?? Thanks! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1771723
post in putUser Bookmark throws error
Hi, I changed the Bookmark example C:\restlet-1.1.4\src\org.restlet.example\org\restlet\example\book\rest\ch7\ApplicationTest.java from Put to Post in putUser method as shown below: public static void putUser(String userName, String password, String fullName, String email) { final Form form = new Form(); form.add(user[password], password); form.add(user[full_name], fullName); form.add(user[email], email); final Response resp = new Client(Protocol.HTTP).post( getUserUri(userName), form.getWebRepresentation()); System.out.println(resp.getStatus()); } But now when I'm trying to add user, it throws error Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request I'm using stable restlet 1.1.7. Can you please tell me if its a bug or what I'm doing wrong??? Thanks! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1733294
Re: post in putUser Bookmark throws error
Hello, this may be because the UserResource does not handle POST requests. Did you try to rename UserResource#storeRepresentation to UserResource#acceptRepresentation? Best regards, Thierry Boileau Hi, I changed the Bookmark example C:\restlet-1.1.4\src\org.restlet.example\org\restlet\example\book\rest\ch7\ApplicationTest.java from Put to Post in putUser method as shown below: public static void putUser(String userName, String password, String fullName, String email) { final Form form = new Form(); form.add(user[password], password); form.add(user[full_name], fullName); form.add(user[email], email); final Response resp = new Client(Protocol.HTTP).post( getUserUri(userName), form.getWebRepresentation()); System.out.println(resp.getStatus()); } But now when I'm trying to add user, it throws error Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request I'm using stable restlet 1.1.7. Can you please tell me if its a bug or what I'm doing wrong??? Thanks! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1733294 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742110