Google App Engine Servlet Design -
i have built server on gae handles 6 different types requests on http post, of involve either creating, updating, or deleting objects datastore. best design this? tell current design , express couple others.
- my current design has requests sent same servlet, , uses "action" parameter part of post distinguish , handle different requests. code server should run included here.
e.g.
public void dopost(httpservletrequest request, httpservletresponse response) { if (request.getparameter("action").equals("action_1")) {..code..} if (request.getparameter("action").equals("action_2")) {..code..} . . . if (request.getparameter("action").equals("action_n")) {..code..} }
2._similar above, instead of code here, servlet acts centralized servlet , calls dedicated servlet action.
3._have dedicated servlet each action.
what pros , cons above designs , preferred way setup server on gae? accessing datastore have impact on design?
i in similar situation. started out option 1, works fine. problem requires lot of argument parsing, converting strings integers , whatnot, manual mapping of command names methods. options 2 , 3 equally laborious, worse because have create bunch of auxiliary methods. if had on again use library work me, 1 (i in fact considering converting this): http://code.google.com/p/json-rpc/. voila, no argument parsing or manual creation of helper classes! 1 happens implement json rpc client-server interface if doing ajax "thick client." if generating of html on server side might want solution.
Comments
Post a Comment