1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.web.struts.action;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.log4j.Logger;
20 import org.apache.log4j.MDC;
21 import org.apache.ojb.broker.OptimisticLockException;
22 import org.apache.struts.Globals;
23 import org.apache.struts.action.Action;
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27 import org.apache.struts.action.InvalidCancelException;
28 import org.apache.struts.action.RequestProcessor;
29 import org.apache.struts.config.FormBeanConfig;
30 import org.apache.struts.config.ForwardConfig;
31 import org.apache.struts.util.RequestUtils;
32 import org.kuali.rice.core.api.CoreApiServiceLocator;
33 import org.kuali.rice.core.api.config.property.ConfigurationService;
34 import org.kuali.rice.core.api.util.RiceConstants;
35 import org.kuali.rice.core.api.util.RiceKeyConstants;
36 import org.kuali.rice.kns.exception.FileUploadLimitExceededException;
37 import org.kuali.rice.kns.service.KNSServiceLocator;
38 import org.kuali.rice.kns.service.SessionDocumentService;
39 import org.kuali.rice.kns.util.ErrorContainer;
40 import org.kuali.rice.kns.util.InfoContainer;
41 import org.kuali.rice.kns.util.KNSConstants;
42 import org.kuali.rice.kns.util.KNSGlobalVariables;
43 import org.kuali.rice.kns.util.WarningContainer;
44 import org.kuali.rice.kns.util.WebUtils;
45 import org.kuali.rice.kns.web.EditablePropertiesHistoryHolder;
46 import org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase;
47 import org.kuali.rice.kns.web.struts.form.KualiForm;
48 import org.kuali.rice.kns.web.struts.form.pojo.PojoForm;
49 import org.kuali.rice.krad.UserSession;
50 import org.kuali.rice.krad.document.Document;
51 import org.kuali.rice.krad.exception.ValidationException;
52 import org.kuali.rice.krad.util.GlobalVariables;
53 import org.kuali.rice.krad.util.KRADConstants;
54 import org.kuali.rice.krad.util.KRADUtils;
55 import org.kuali.rice.krad.util.LegacyUtils;
56 import org.kuali.rice.krad.util.MessageMap;
57 import org.springframework.transaction.PlatformTransactionManager;
58 import org.springframework.transaction.TransactionStatus;
59 import org.springframework.transaction.support.TransactionCallback;
60 import org.springframework.transaction.support.TransactionTemplate;
61 import org.springmodules.orm.ojb.OjbOperationException;
62
63 import javax.servlet.ServletException;
64 import javax.servlet.http.HttpServletRequest;
65 import javax.servlet.http.HttpServletResponse;
66 import javax.servlet.http.HttpSession;
67 import java.io.IOException;
68
69
70
71
72
73
74 @Deprecated
75 public class KualiRequestProcessor extends RequestProcessor {
76
77 private static final String MDC_DOC_ID = "docId";
78 private static final String PREVIOUS_REQUEST_EDITABLE_PROPERTIES_GUID_PARAMETER_NAME = "actionEditablePropertiesGuid";
79
80 private static Logger LOG = Logger.getLogger(KualiRequestProcessor.class);
81
82 private SessionDocumentService sessionDocumentService;
83 private PlatformTransactionManager transactionManager;
84
85 @Override
86 public void process(final HttpServletRequest request,
87 final HttpServletResponse response) throws IOException, ServletException {
88
89 LegacyUtils.beginLegacyContext();
90 try {
91 if (LOG.isInfoEnabled()) {
92 LOG.info(new StringBuffer("Started processing request: '").append(request.getRequestURI()).append(
93 "' w/ query string: '").append(request.getQueryString()).append("'"));
94 }
95
96 try {
97 strutsProcess(request, response);
98 } catch (FileUploadLimitExceededException e) {
99 ActionForward actionForward = processException(request, response, e, e.getActionForm(),
100 e.getActionMapping());
101 processForwardConfig(request, response, actionForward);
102 } finally {
103 KNSGlobalVariables.setKualiForm(null);
104 }
105
106 try {
107 ActionForm form = WebUtils.getKualiForm(request);
108
109 if (form != null && form instanceof KualiDocumentFormBase) {
110 String docId = ((KualiDocumentFormBase) form).getDocId();
111 if (docId != null) {
112 MDC.put(MDC_DOC_ID, docId);
113 }
114 }
115
116 String refreshCaller = request.getParameter(KRADConstants.REFRESH_CALLER);
117 if (form != null && KualiDocumentFormBase.class.isAssignableFrom(form.getClass()) && !KRADConstants
118 .QUESTION_REFRESH.equalsIgnoreCase(refreshCaller)) {
119 KualiDocumentFormBase docForm = (KualiDocumentFormBase) form;
120 Document document = docForm.getDocument();
121 String docFormKey = docForm.getFormKey();
122
123 UserSession userSession = (UserSession) request.getSession().getAttribute(
124 KRADConstants.USER_SESSION_KEY);
125
126 if (WebUtils.isDocumentSession(document, docForm)) {
127 getSessionDocumentService().setDocumentForm(docForm, userSession, request.getRemoteAddr());
128 }
129
130 Boolean exitingDocument = (Boolean) request.getAttribute(KRADConstants.EXITING_DOCUMENT);
131
132 if (exitingDocument != null && exitingDocument.booleanValue()) {
133
134
135 getSessionDocumentService().purgeDocumentForm(docForm.getDocument().getDocumentNumber(),
136 docFormKey, userSession, request.getRemoteAddr());
137 }
138 }
139
140 if (LOG.isInfoEnabled()) {
141 LOG.info(new StringBuffer("Finished processing request: '").append(request.getRequestURI()).append(
142 "' w/ query string: '").append(request.getQueryString()).append("'"));
143 }
144
145 } finally {
146
147 MDC.remove(MDC_DOC_ID);
148 }
149 } finally {
150 LegacyUtils.endLegacyContext();
151 }
152 }
153
154 @Override
155 protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) {
156 final UserSession session = KRADUtils.getUserSessionFromRequest(request);
157
158 if (session == null) {
159 throw new IllegalStateException("the user session has not been established");
160 }
161 GlobalVariables.setUserSession(session);
162 KNSGlobalVariables.clear();
163 return true;
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177 public void strutsProcess(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
178
179
180 request = processMultipart(request);
181
182
183 String path = processPath(request, response);
184 if (path == null) {
185 return;
186 }
187
188 if (log.isDebugEnabled()) {
189 log.debug("Processing a '" + request.getMethod() +
190 "' for path '" + path + "'");
191 }
192
193
194 processLocale(request, response);
195
196
197 processContent(request, response);
198 processNoCache(request, response);
199
200
201 if (!processPreprocess(request, response)) {
202 return;
203 }
204
205 this.processCachedMessages(request, response);
206
207
208 ActionMapping mapping = processMapping(request, response, path);
209 if (mapping == null) {
210 return;
211 }
212
213
214 if (!processRoles(request, response, mapping)) {
215 return;
216 }
217
218 processFormActionAndForward(request, response, mapping);
219
220 }
221
222 public void processFormActionAndForward(final HttpServletRequest request, final HttpServletResponse response, final ActionMapping mapping) throws ServletException, IOException {
223 ActionForm form = processActionForm(request, response, mapping);
224 processPopulate(request, response, form, mapping);
225
226
227 Action action = processActionCreate(request, response, mapping);
228
229 if (action != null) {
230
231 ActionForward forward = processActionPerform(request, response, action, form, mapping);
232
233 if (forward != null) {
234 if (forward.getRedirect() && forward.getName()!= null && forward.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME)) {
235 LOG.info("Attempt to open a document with a status of \"Initiated\" detected");
236 return;
237 }
238
239 processForwardConfig(request, response, forward);
240 }
241 }
242 }
243
244
245
246
247
248
249
250
251
252 private String getDocumentNumber(HttpServletRequest request) {
253 String documentNumber = request.getParameter(KRADConstants.DOCUMENT_DOCUMENT_NUMBER);
254
255
256 if (documentNumber == null) {
257 documentNumber = request.getParameter(KRADConstants.DOC_NUM);
258 }
259
260 if (documentNumber == null) {
261 documentNumber = request.getParameter("documentId");
262 }
263
264 return documentNumber;
265 }
266
267
268
269
270
271 @Override
272 protected void processPopulate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws ServletException {
273 if (form instanceof KualiForm) {
274
275
276
277
278
279 KNSGlobalVariables.setKualiForm((KualiForm) form);
280 }
281
282
283 if (!(form instanceof PojoForm)) {
284 super.processPopulate(request, response, form, mapping);
285 return;
286 }
287
288 final String previousRequestGuid = request.getParameter(KualiRequestProcessor.PREVIOUS_REQUEST_EDITABLE_PROPERTIES_GUID_PARAMETER_NAME);
289
290 ((PojoForm)form).clearEditablePropertyInformation();
291 ((PojoForm)form).registerStrutsActionMappingScope(mapping.getScope());
292
293 String multipart = mapping.getMultipartClass();
294 if (multipart != null) {
295 request.setAttribute(Globals.MULTIPART_KEY, multipart);
296 }
297
298 form.setServlet(this.servlet);
299 form.reset(mapping, request);
300
301 ((PojoForm)form).setPopulateEditablePropertiesGuid(previousRequestGuid);
302
303 ((PojoForm) form).populate(request);
304 request.setAttribute("UnconvertedValues", ((PojoForm) form).getUnconvertedValues().keySet());
305 request.setAttribute("UnconvertedHash", ((PojoForm) form).getUnconvertedValues());
306 }
307
308
309
310
311
312 @Override
313 protected boolean processValidate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws IOException, ServletException, InvalidCancelException {
314
315
316 if (GlobalVariables.getMessageMap().hasNoErrors()) {
317 if (form == null) {
318 return (true);
319 }
320
321 if (request.getAttribute(Globals.CANCEL_KEY) != null) {
322 if (LOG.isDebugEnabled()) {
323 LOG.debug(" Cancelled transaction, skipping validation");
324 }
325 return (true);
326 }
327
328
329 if (!mapping.getValidate()) {
330 return (true);
331 }
332
333
334 super.processValidate(request, response, form, mapping);
335 }
336
337 publishMessages(request);
338 if (!GlobalVariables.getMessageMap().hasNoErrors()) {
339
340 if (form.getMultipartRequestHandler() != null) {
341 if (LOG.isDebugEnabled()) {
342 LOG.debug(" Rolling back multipart request");
343 }
344 form.getMultipartRequestHandler().rollback();
345 }
346
347
348 if (form instanceof PojoForm) {
349 ((PojoForm) form).processValidationFail();
350 }
351
352
353 String input = mapping.getInput();
354 if (input == null) {
355 if (LOG.isDebugEnabled()) {
356 LOG.debug(" Validation failed but no input form available");
357 }
358 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getInternal().getMessage("noInput", mapping.getPath()));
359 return (false);
360 }
361
362 if (moduleConfig.getControllerConfig().getInputForward()) {
363 ForwardConfig forward = mapping.findForward(input);
364 processForwardConfig(request, response, forward);
365 } else {
366 internalModuleRelativeForward(input, request, response);
367 }
368
369 return (false);
370 }
371 return true;
372 }
373
374
375
376
377
378 @Override
379 protected ActionForm processActionForm(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) {
380
381 String documentNumber = getDocumentNumber(request);
382 if (documentNumber != null) { MDC.put(MDC_DOC_ID, documentNumber); }
383
384 UserSession userSession = (UserSession) request.getSession().getAttribute(KRADConstants.USER_SESSION_KEY);
385
386 String docFormKey = request.getParameter(KRADConstants.DOC_FORM_KEY);
387 String methodToCall = request.getParameter(KRADConstants.DISPATCH_REQUEST_PARAMETER);
388 String refreshCaller = request.getParameter(KRADConstants.REFRESH_CALLER);
389
390 String documentWebScope = request.getParameter(KRADConstants.DOCUMENT_WEB_SCOPE);
391
392 if (mapping.getPath().startsWith(KRADConstants.REFRESH_MAPPING_PREFIX) || KRADConstants.RETURN_METHOD_TO_CALL.equalsIgnoreCase(methodToCall) ||
393 KRADConstants.QUESTION_REFRESH.equalsIgnoreCase(refreshCaller) || KRADConstants.TEXT_AREA_REFRESH.equalsIgnoreCase(refreshCaller) || KRADConstants
394 .SESSION_SCOPE.equalsIgnoreCase(documentWebScope)) {
395 ActionForm form = null;
396
397 GlobalVariables.getUserSession().removeObjectsByPrefix(KRADConstants.SEARCH_LIST_KEY_PREFIX);
398
399
400
401
402 if (userSession.retrieveObject(docFormKey) != null) {
403 LOG.debug("getDecomentForm KualiDocumentFormBase from session");
404 form = (ActionForm) userSession.retrieveObject(docFormKey);
405 } else if (StringUtils.isNotBlank(documentNumber)) {
406 form = getSessionDocumentService().getDocumentForm(documentNumber, docFormKey, userSession, request.getRemoteAddr());
407 }
408 request.setAttribute(mapping.getAttribute(), form);
409 if (!KRADConstants.SESSION_SCOPE.equalsIgnoreCase(documentWebScope)) {
410 userSession.removeObject(docFormKey);
411 }
412
413
414
415 String contentType = request.getContentType();
416 String method = request.getMethod();
417 if (("POST".equalsIgnoreCase(method) && contentType != null && contentType.startsWith("multipart/form-data"))) {
418
419
420 WebUtils.getMultipartParameters(request, null, form, mapping);
421 }
422
423 if (form != null) {
424 return form;
425 }
426 }
427
428
429
430
431
432
433 ActionForm form = super.processActionForm(request, response, mapping);
434
435
436 String contentType = request.getContentType();
437 String method = request.getMethod();
438
439 if ("GET".equalsIgnoreCase(method) && StringUtils.isNotBlank(methodToCall) && form instanceof PojoForm &&
440 ((PojoForm) form).getMethodToCallsToBypassSessionRetrievalForGETRequests().contains(methodToCall)) {
441 return createNewActionForm(mapping, request);
442 }
443
444
445
446
447
448
449
450
451
452
453
454 if (("POST".equalsIgnoreCase(method) && contentType != null && contentType.startsWith("multipart/form-data"))) {
455 WebUtils.getMultipartParameters(request, null, form, mapping);
456 docFormKey = request.getParameter(KRADConstants.DOC_FORM_KEY);
457 documentWebScope = request.getParameter(KRADConstants.DOCUMENT_WEB_SCOPE);
458
459 documentNumber = getDocumentNumber(request);
460
461 if (KRADConstants.SESSION_SCOPE.equalsIgnoreCase(documentWebScope) ||
462 (form instanceof KualiDocumentFormBase && WebUtils
463 .isDocumentSession(((KualiDocumentFormBase) form).getDocument(),
464 (KualiDocumentFormBase) form))) {
465
466 Object userSessionObject = userSession.retrieveObject(docFormKey);
467 if ( userSessionObject != null && userSessionObject instanceof ActionForm ) {
468 LOG.debug("getDocumentForm KualiDocumentFormBase from session");
469 form = (ActionForm) userSessionObject;
470 } else {
471 ActionForm tempForm = getSessionDocumentService().getDocumentForm(documentNumber, docFormKey, userSession, request.getRemoteAddr());
472 if ( tempForm != null ) {
473 form = tempForm;
474 }
475 }
476
477 request.setAttribute(mapping.getAttribute(), form);
478 if (form != null) {
479 return form;
480 }
481 }
482 }
483 return form;
484 }
485
486
487
488
489
490
491
492
493
494
495
496 @Override
497 protected ActionForward processActionPerform(final HttpServletRequest request, final HttpServletResponse response, final Action action, final ActionForm form, final ActionMapping mapping) throws IOException, ServletException {
498 try {
499 TransactionTemplate template = new TransactionTemplate(getTransactionManager());
500 ActionForward forward = null;
501 try {
502 forward = (ActionForward) template.execute(new TransactionCallback() {
503 public Object doInTransaction(TransactionStatus status) {
504 ActionForward actionForward = null;
505 try {
506 actionForward = action.execute(mapping, form, request, response);
507 } catch (Exception e) {
508 if (e.getMessage()!= null && e.getMessage().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME)) {
509 ConfigurationService kualiConfigurationService = CoreApiServiceLocator
510 .getKualiConfigurationService();
511 StringBuffer sb = new StringBuffer();
512 sb.append(kualiConfigurationService.getPropertyValueAsString(KRADConstants.KRAD_URL_KEY));
513 sb.append(kualiConfigurationService.getPropertyValueAsString(KRADConstants.KRAD_INITIATED_DOCUMENT_URL_KEY));
514 return new ActionForward(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME, sb.toString() ,true);
515 }
516
517
518
519
520
521
522
523
524 throw new WrappedRuntimeException(e);
525 }
526 if (status.isRollbackOnly()) {
527
528
529
530
531
532
533 throw new WrappedActionForwardRuntimeException(actionForward);
534 }
535 return actionForward;
536 }
537 });
538 } catch (WrappedActionForwardRuntimeException e) {
539 forward = e.getActionForward();
540 }
541
542 publishMessages(request);
543 saveMessages(request);
544 saveAuditErrors(request);
545
546 if (form instanceof PojoForm) {
547 if (((PojoForm)form).getEditableProperties() == null
548 || ((PojoForm)form).getEditableProperties().isEmpty()) {
549 EditablePropertiesHistoryHolder holder = (EditablePropertiesHistoryHolder) GlobalVariables.getUserSession().getObjectMap().get(
550 KRADConstants.EDITABLE_PROPERTIES_HISTORY_HOLDER_ATTR_NAME);
551 if (holder == null) {
552 holder = new EditablePropertiesHistoryHolder();
553 }
554
555 final String guid = holder.addEditablePropertiesToHistory(((PojoForm)form).getEditableProperties());
556 ((PojoForm)form).setActionEditablePropertiesGuid(guid);
557 GlobalVariables.getUserSession().addObject(KRADConstants.EDITABLE_PROPERTIES_HISTORY_HOLDER_ATTR_NAME, holder);
558 }
559 }
560
561 return forward;
562
563 } catch (Exception e) {
564 if (e instanceof WrappedRuntimeException) {
565 e = (Exception) e.getCause();
566 }
567 if (e instanceof ValidationException) {
568
569 if (GlobalVariables.getMessageMap().hasNoErrors()) {
570
571 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_CUSTOM, e.getMessage());
572 }
573
574 if (form instanceof PojoForm) {
575 if (((PojoForm)form).getEditableProperties() == null
576 || ((PojoForm)form).getEditableProperties().isEmpty()) {
577 EditablePropertiesHistoryHolder holder = (EditablePropertiesHistoryHolder) GlobalVariables.getUserSession().getObjectMap().get(
578 KRADConstants.EDITABLE_PROPERTIES_HISTORY_HOLDER_ATTR_NAME);
579 if (holder == null) {
580 holder = new EditablePropertiesHistoryHolder();
581 }
582
583 final String guid = holder.addEditablePropertiesToHistory(((PojoForm)form).getEditableProperties());
584 ((PojoForm)form).setActionEditablePropertiesGuid(guid);
585 GlobalVariables.getUserSession().addObject(KRADConstants.EDITABLE_PROPERTIES_HISTORY_HOLDER_ATTR_NAME, holder);
586 }
587 }
588
589 publishMessages(request);
590 return mapping.findForward(RiceConstants.MAPPING_BASIC);
591 }
592
593 publishMessages(request);
594
595 return (processException(request, response, e, form, mapping));
596 }
597 }
598
599 private static class WrappedActionForwardRuntimeException extends RuntimeException {
600 private ActionForward actionForward;
601
602 public WrappedActionForwardRuntimeException(ActionForward actionForward) {
603 this.actionForward = actionForward;
604 }
605
606 public ActionForward getActionForward() {
607 return actionForward;
608 }
609 }
610
611
612
613
614
615
616
617 @Override
618 protected ActionForward processException(HttpServletRequest request, HttpServletResponse response, Exception exception, ActionForm form, ActionMapping mapping) throws IOException, ServletException {
619 ActionForward actionForward = null;
620
621 try {
622 actionForward = super.processException(request, response, exception, form, mapping);
623 } catch (IOException e) {
624 logException(e);
625 throw e;
626 } catch (ServletException e) {
627
628 Throwable rootCause = e.getRootCause();
629 if (rootCause instanceof OjbOperationException) {
630 OjbOperationException ooe = (OjbOperationException) rootCause;
631
632 Throwable subcause = ooe.getCause();
633 if (subcause instanceof OptimisticLockException) {
634 OptimisticLockException ole = (OptimisticLockException) subcause;
635
636 StringBuffer message = new StringBuffer(e.getMessage());
637
638 Object sourceObject = ole.getSourceObject();
639 if (sourceObject != null) {
640 message.append(" (sourceObject is ");
641 message.append(sourceObject.getClass().getName());
642 message.append(")");
643 }
644
645 e = new ServletException(message.toString(), rootCause);
646 }
647 }
648
649 logException(e);
650 throw e;
651 }
652 return actionForward;
653 }
654
655 private void logException(Exception e) {
656 LOG.error("unhandled exception thrown by KualiRequestProcessor.processActionPerform", e);
657 }
658
659
660
661
662
663 private void publishMessages(HttpServletRequest request) {
664 MessageMap errorMap = GlobalVariables.getMessageMap();
665 if (!errorMap.hasNoErrors()) {
666 ErrorContainer errorContainer = new ErrorContainer(errorMap);
667
668 request.setAttribute("ErrorContainer", errorContainer);
669 request.setAttribute(Globals.ERROR_KEY, errorContainer.getRequestErrors());
670 request.setAttribute("ErrorPropertyList", errorContainer.getErrorPropertyList());
671 }
672
673 if (errorMap.hasWarnings()) {
674 WarningContainer warningsContainer = new WarningContainer(errorMap);
675
676 request.setAttribute("WarningContainer", warningsContainer);
677 request.setAttribute("WarningActionMessages", warningsContainer.getRequestMessages());
678 request.setAttribute("WarningPropertyList", warningsContainer.getMessagePropertyList());
679 }
680
681 if (errorMap.hasInfo()) {
682 InfoContainer infoContainer = new InfoContainer(errorMap);
683
684 request.setAttribute("InfoContainer", infoContainer);
685 request.setAttribute("InfoActionMessages", infoContainer.getRequestMessages());
686 request.setAttribute("InfoPropertyList", infoContainer.getMessagePropertyList());
687 }
688 }
689
690
691
692
693
694 private void saveMessages(HttpServletRequest request) {
695 if (!KNSGlobalVariables.getMessageList().isEmpty()) {
696 request.setAttribute(KRADConstants.GLOBAL_MESSAGES, KNSGlobalVariables.getMessageList().toActionMessages());
697 }
698 }
699
700
701
702
703
704 private void saveAuditErrors(HttpServletRequest request) {
705 if (!KNSGlobalVariables.getAuditErrorMap().isEmpty()) {
706 request.setAttribute(KNSConstants.AUDIT_ERRORS, KNSGlobalVariables.getAuditErrorMap());
707 }
708 }
709
710
711
712
713
714 @SuppressWarnings("serial")
715 private static class WrappedRuntimeException extends RuntimeException {
716 public WrappedRuntimeException(Exception e) {
717 super(e);
718 }
719 }
720
721
722
723
724 public SessionDocumentService getSessionDocumentService() {
725 if ( sessionDocumentService == null ) {
726 sessionDocumentService = KNSServiceLocator.getSessionDocumentService();
727 }
728 return this.sessionDocumentService;
729 }
730
731
732
733
734 public PlatformTransactionManager getTransactionManager() {
735 if ( transactionManager == null ) {
736 transactionManager = KNSServiceLocator.getTransactionManager();
737 }
738 return this.transactionManager;
739 }
740
741 private ActionForm createNewActionForm(ActionMapping mapping, HttpServletRequest request) {
742 String name = mapping.getName();
743 FormBeanConfig config = moduleConfig.findFormBeanConfig(name);
744 if (config == null) {
745 log.warn("No FormBeanConfig found under '" + name + "'");
746 return (null);
747 }
748 ActionForm instance = RequestUtils.createActionForm(config, servlet);
749 if ("request".equals(mapping.getScope())) {
750 request.setAttribute(mapping.getAttribute(), instance);
751 } else {
752 HttpSession session = request.getSession();
753 session.setAttribute(mapping.getAttribute(), instance);
754 }
755 return instance;
756 }
757 }