01: package org.strecks.controller.chain.command;
02:
03: import org.apache.struts.chain.commands.ActionCommandBase;
04: import org.apache.struts.chain.contexts.ActionContext;
05: import org.apache.struts.chain.contexts.ServletActionContext;
06: import org.strecks.preprocess.RequestPreprocessor;
07: import org.strecks.preprocess.SessionErrorPreprocessor;
08:
09: /**
10: * Added to chain as a pre-process command
11: * @author Phil Zoio
12: */
13: public class Preprocess extends ActionCommandBase {
14:
15: private RequestPreprocessor preProcessor;
16:
17: public Preprocess() {
18: super ();
19: preProcessor = newRequestPreprocessor();
20: }
21:
22: protected RequestPreprocessor newRequestPreprocessor() {
23: return new SessionErrorPreprocessor();
24: }
25:
26: @Override
27: public boolean execute(ActionContext context) throws Exception {
28: ServletActionContext sc = (ServletActionContext) context;
29: preProcessor.preprocessRequest(sc.getRequest());
30: return false;
31: }
32:
33: }
|