<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">That seems to do the trick - now, where do we apply the fix? :-)<div><br><div><div>On Dec 16, 2013, at 3:06 PM, Vineet Reynolds Pereira &lt;<a href="mailto:vpereira@redhat.com">vpereira@redhat.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><br>----- Original Message -----<br><blockquote type="cite">From: "Lucas Holmquist" &lt;<a href="mailto:lholmqui@redhat.com">lholmqui@redhat.com</a>&gt;<br>To: "AeroGear Developer Mailing List" &lt;<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>&gt;<br>Cc: "Vineet Reynolds Pereira" &lt;<a href="mailto:vpereira@redhat.com">vpereira@redhat.com</a>&gt;<br>Sent: Tuesday, December 17, 2013 12:53:25 AM<br>Subject: Re: [aerogear-dev] Aerogear.js for CRUD<br><br><br>On Dec 16, 2013, at 1:52 PM, Burr Sutter &lt;<a href="mailto:bsutter@redhat.com">bsutter@redhat.com</a>&gt; wrote:<br><br><blockquote type="cite">Adding Vineet as he has spent time on the Forge REST scaffolding.<br><br>On Dec 16, 2013, at 7:01 AM, Sebastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com">scm.blanc@gmail.com</a>&gt; wrote:<br><br><blockquote type="cite">Burr,<br>I've added some logs statements on the client and basically it seems it<br>can not parse the response from the server :<br><br>I/Web Console( 1386): textStatus: parsererror at<br><a href="file:///android_asset/www/js/index.js:103">file:///android_asset/www/js/index.js:103</a><br>I/Web Console( 1386): error: SyntaxError: Unexpected end of input at<br>file:///android_asset/www/js/index.js:104<br><br>If I do a CURL like this :<br>curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H<br>"Content-type: application/json" -X POST -d<br>'{"phoneNumber":"1234567890","email":"newTest@test.com","name":"newTest"}'<br>http://agmobile-html5.rhcloud.com/rest/forge/members<br><br></blockquote>I should have pointed to the sources to the REST endpoint:<br><a href="https://github.com/burrsutter/agmobile/blob/master/src/main/java/com/burrsutter/agmobile/rest/MemberEndpoint.java">https://github.com/burrsutter/agmobile/blob/master/src/main/java/com/burrsutter/agmobile/rest/MemberEndpoint.java</a><br>This was generated by Forge as I am too lazy to type up a full CRUD REST<br>endpoint myself :-)<br><br><blockquote type="cite">I got an correct answer but the content type is 'text/plain' , please<br>check your rest endpoint to be sure it's producing json as output, that<br>should solve your issue.<br></blockquote>It says<br>&nbsp;&nbsp;@POST<br>&nbsp;&nbsp;@Consumes("application/json")<br><br></blockquote>needs a @Produces("application/json")<br></blockquote><br>I'm not sure that will help. The response is a HTTP 201 with a Location header.<br>Is the client expecting an entity of type application/json in the response ?<br><br>If yes, then the method should look like:<br><br>&nbsp;&nbsp;@POST<br>&nbsp;&nbsp;@Consumes("application/json")<br>&nbsp;&nbsp;public Response create(MemberDTO dto)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Member entity = dto.fromDTO(null, em);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;em.persist(entity);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return Response.created(UriBuilder.fromResource(MemberEndpoint.class).path(String.valueOf(entity.getId())).build()).entity(entity).build();<br>&nbsp;&nbsp;}<br><br>I've added : .entity(entity) in the above method to populate the response with the entity.<br><br><blockquote type="cite"><br><blockquote type="cite"><br><blockquote type="cite"><br>Could you also paste the commands you used in Forge to scaffold the REST<br>endpoints so that we can check there hasn't been an incompatibility<br>introduced ?<br></blockquote>I just used the Forge Wizard that is built into JBDS/Tools<br><a href="http://screencast.com/t/QrKkCoFZMUn">http://screencast.com/t/QrKkCoFZMUn</a><br><br>error.status is 201<br>error.responseText is blank<br><br><blockquote type="cite"><br><br><br><br>On Sat, Dec 14, 2013 at 6:06 PM, Burr Sutter &lt;bsutter@redhat.com&gt; wrote:<br>I am having a problem with pipe.save(), likely user error :-)<br><br>For some reason, the POST is occurring, the save seems to work but the<br>error callback is invoked, not the success method.<br><br>And I am doing all of this in the context of our tooling which has some<br>limitations (auto-closing console/firebug lite)<br><br>http://screencast.com/t/gosd7Qnhz<br><br>REST endpoint:<br>http://agmobile-html5.rhcloud.com/rest/forge/members<br>Use of Forge, with the Member.java entity to offer full CRUD capabilities<br><br>Sources:<br>https://github.com/burrsutter/AGContacts/blob/master/www/js/index.js<br><br><br>_______________________________________________<br>aerogear-dev mailing list<br>aerogear-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/aerogear-dev<br><br>_______________________________________________<br>aerogear-dev mailing list<br>aerogear-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/aerogear-dev<br></blockquote><br>_______________________________________________<br>aerogear-dev mailing list<br>aerogear-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/aerogear-dev<br></blockquote><br><br></blockquote>_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</div></blockquote></div><br></div></body></html>