S2Struts

お昼時間にやってみたRequestProcessor#processActionCreateを
オーバーライドするだけで良いみたい。
S2とStrutsの相性いいなぁ。(笑)


protected Action processActionCreate(HttpServletRequest request,
HttpServletResponse response,
ActionMapping mapping)
throws IOException {

String className = mapping.getType();
Action instance = null;
synchronized (actions) {
instance = (Action) actions.get(className);
if (instance != null) {
return (instance);
}
S2Container container = S2ContainerServlet.getContainer();
try {
Class clazz = RequestUtils.applicationClass(className);
if (container.hasComponentDef(clazz)) {
instance = (Action) container.getComponent(clazz);
} else {
instance = (Action) RequestUtils.applicationInstance(className);
}
} catch (Exception e) {
response.sendError(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
getInternal().getMessage("actionCreate", mapping.getPath()));
return (null);
}
instance.setServlet(this.servlet);
actions.put(className, instance);
}
return (instance);
}