java - A enquiry about NetBeans generated RESTful Web Service POST path and more -
i'm new restful. netbeans can generate restful web service entity class, database etc. think cool master stressful hand code every web service.
can ask should path of post request "create" method? , caller class (listed below) takes 3 parameters construct it(see constructor below) (i pass 3 parameters android client). "create" method takes caller whole. do? " @consumes({"application/xml", "application/json"})" indicate method consumes xml or json, have wrap 3 parameters json object post?
and have method path annotation method? such @path("/create")? because there many other methods (get, delete etc). don't know path of post request "create" method.
my attempt be, (after adding path annotation "create" method - @path("/create")) http://my laptop's ip:8080/androidrestful2/com.erikchenmelbourne.entities.caller/create?id=xxx&number=xxx&information=xxx
i new, appreciated. thanks.
@stateless @path("com.erikchenmelbourne.entities.caller") public class callerfacaderest extends abstractfacade<caller> { @persistencecontext(unitname = "androidrestful2pu") private entitymanager em; public callerfacaderest() { super(caller.class); } @post @override @consumes({"application/xml", "application/json"}) public void create(caller entity) { super.create(entity); }
caller class has constructors , use 3rd one
public caller() { } public caller(integer id) { this.id = id; } public caller(integer id, string number, string information) { this.id = id; this.number = number; this.information = information; }
Comments
Post a Comment