@WebServlet(description="jserv.sample example: extend serv handler", urlPatterns="/custom.serv11") public class CustomServ extends io.odysz.semantic.jserv.ServPort<SampleReq>
Sample serv (Port = user.serv) shows how user can extend basic serv API
with help of semantic-transact SQL builder
This also shows how user can extend ServPort
with typed message handler,
antson, which is new to v1.1.
var conn = jconsts.conn; function saveTooleA() { var dat = {borrowId: 'borrow-001', items: []}; dat.items.push(['item001', 3]); // return 3 of tiem001 var usrReq = new jvue.UserReq(conn, "r_tools_borrows") // turn back tools - or any function branch tag handled by tools.serv .a("A") // or reaplace these 2 set() with data(dat) .set('borrowId', 'borrow-001') .set('items', [['item001', 3]]); var jmsg = ssClient // ssClient's current user action is handled by jeasy when loading menu .usrCmd('save') // return ssClient itself .userReq(conn, engports.tools, usrReq); // return the JMessage<UserReq> object // You should get sqls at server side like this: // delete from r_tools_borrows where borrowId = 'borrow-001' // insert into detailsTbl (item001) values ('3.0') // update borrowTbl set total= where borrowId = 'borrow-001' ssClient.commit(jmsg, function(resp) { EasyMsger.ok(EasyMsger.m.saved); }, EasyMsger.error); }
Constructor and Description |
---|
CustomServ() |
Modifier and Type | Method and Description |
---|---|
protected void |
onGet(io.odysz.semantic.jprotocol.AnsonMsg<SampleReq> msg,
javax.servlet.http.HttpServletResponse resp) |
protected void |
onPost(io.odysz.semantic.jprotocol.AnsonMsg<SampleReq> msg,
javax.servlet.http.HttpServletResponse resp) |
doGet, doPost, err, ok, ok, ok, ok, ok, onGetAnsonException, write
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
protected void onGet(io.odysz.semantic.jprotocol.AnsonMsg<SampleReq> msg, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException, io.odysz.anson.x.AnsonException, io.odysz.semantics.x.SemanticException
onGet
in class io.odysz.semantic.jserv.ServPort<SampleReq>
javax.servlet.ServletException
IOException
io.odysz.anson.x.AnsonException
io.odysz.semantics.x.SemanticException
protected void onPost(io.odysz.semantic.jprotocol.AnsonMsg<SampleReq> msg, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException, io.odysz.anson.x.AnsonException, io.odysz.semantics.x.SemanticException
onPost
in class io.odysz.semantic.jserv.ServPort<SampleReq>
javax.servlet.ServletException
IOException
io.odysz.anson.x.AnsonException
io.odysz.semantics.x.SemanticException
Copyright © 2023. All rights reserved.