Title: Servlets Design Question

I'm rewamping an old system with Servlets and a Velocity templating engine.  Servlets talk to the remote app server via a cleint-server protocol.  A typical request then is as follows:

doService(request, response) { //"main method doGet/doPost"

if (action == "getXXX") {

Vector result = callRemoteGetXXX(request);
showUserXXX(result, request, response);

} else if (action == "getYYY") {

//etc.

}



so basically, my main servlet becomes a very bloated file with doService(), as well as all of the  callRemoteGetXXX(request) and showUserXXX(result, request, response) methods of which there are quite a few.  What other accepted designs there are for placing the

callRemoteGetXXX(request) and showUserXXX(result, request, response) methods in separate files? 

1) The old design had loosely grouped actions into types and had an adapter for each type that passed calls around in the context back to the servlet.   All the response calls/formatting was handled in the root CustomServlet superclass.

Not a good idea IMHO.

2) create a RemoteCallManager DAO-type class, where all the (now static) callRemoteGetXXX(request) methods would live:

Vector result = RemoteCallManager.callRemoteGetXXX(request);

For handling of the response, maybe I can stuff the result Vector into the request object and then do some type of Context.forward(responseServletForAllTransactionsOfTypeRelatedToXXX, request, response);

For handling all those responses, they will be loosely grouped into response types and forwarded to 3-4 different "response only"  servlets accordingly.

I like this better, but maybe there is another good way or some implementation/design tricks out there?

Any other ideas?

Thanks in advance.

Greg

P.S. we're on Apache/JServ 1.1/Velocity Java 1.4.1 Solaris








---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

Reply via email to