[Opensource] prePerform(), postPerform() Template Methods
larry hamel
expresso at codeguild.com
Tue Oct 28 22:21:37 PST 2003
At 05:02 PM 10/28/2003, you wrote:
>processLogin has the call to postLoginProcessing(request, response); which you override and works very well.
>
>could we do this for processLogout as well. add postLogoutProcessing that can be overriden if required.
>
good idea, Eddie. I'll put this in if Mike agrees.
Similarly, I perceive a need for a Template Method pattern to enable pre- and postprocessing on the main controller path,
nextState.perform(stateForm, myRequest, myResponse);
(Line 1310 in Controller.Java)
For example, common code dealing with a header and footer could be put there.
Since a controller is just an arbitrary collection of states (less arbitrary if you use flow control), it seems OK that all states within a controller would share the same pre- and postprocessing.
Specifically, consider the following to replace line 1310:
prePerform(nextState, myRequest, myResponse);
nextState.perform(stateForm, myRequest, myResponse);
postPerform(nextState, myRequest, myResponse);
Where the implementation is just a no-op in the superclass.
void prePerform(nextState, ControllerRequest request, ControllerResponse response) throws ControllerException {}
(etc.)
What you think?
larry
More information about the Opensource
mailing list