I built a server on GAE that processes 6 requests of various types via HTTP POST, all of which are related to creating, updating or deleting objects from the data store. What is the best design for this? I will tell you my current design and express a couple of others.
- My current project has all the requests sent to the same servlet, and uses the action parameter as part of the POST to distinguish and process the various requests. The code that the server should run is included here.
eg.
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._Compared to the above, but instead of the code here, this servlet simply acts as a centralized servlet and invokes a dedicated servlet for this action.
3._Use only the dedicated servlet for each action.
GAE? ?