use of org.apache.struts.action.DynaActionForm in project iaf by ibissource.
the class ActionBase method execute.
/**
* This proc should start with <code>initAction(request)</code>
* @see Action
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
if (isWriteToSecLog()) {
if (secLogMessage && isWriteSecLogMessage()) {
DynaActionForm dynaActionForm = (DynaActionForm) form;
String form_message = null;
try {
form_message = (String) dynaActionForm.get("message");
} catch (IllegalArgumentException e) {
try {
form_message = (String) dynaActionForm.get("query");
} catch (IllegalArgumentException e2) {
form_message = "could not derive message or query from DynaForm";
}
}
secLog.info(HttpUtils.getExtendedCommandIssuedBy(request, secLogParamNames, form_message));
} else {
secLog.info(HttpUtils.getExtendedCommandIssuedBy(request, secLogParamNames));
}
}
return executeSub(mapping, form, request, response);
}
use of org.apache.struts.action.DynaActionForm in project sonar-java by SonarSource.
the class TestRequestUtils method testCreateActionForm3a.
// Default module -- Dynamic ActionForm should be created
public void testCreateActionForm3a() {
request.setPathElements("/myapp", "/dynamic.do", null, null);
ActionMapping mapping = (ActionMapping) moduleConfig.findActionConfig("/dynamic");
assertNotNull("Found /dynamic mapping", mapping);
assertNotNull("Mapping has non-null name", mapping.getName());
assertEquals("Mapping has correct name", "dynamic", mapping.getName());
assertNotNull("AppConfig has form bean " + mapping.getName(), moduleConfig.findFormBeanConfig(mapping.getName()));
ActionForm form = RequestUtils.createActionForm(request, mapping, moduleConfig, null);
assertNotNull("ActionForm returned", form);
assertTrue("ActionForm of correct type", form instanceof DynaActionForm);
}
use of org.apache.struts.action.DynaActionForm in project sonar-java by SonarSource.
the class TestRequestUtils method testCreateActionForm3b.
// Second module -- Dynamic ActionForm should be created
public void testCreateActionForm3b() {
request.setPathElements("/myapp", "/2/dynamic2.do", null, null);
ActionMapping mapping = (ActionMapping) moduleConfig2.findActionConfig("/dynamic2");
assertNotNull("Found /dynamic2 mapping", mapping);
assertNotNull("Mapping has non-null name", mapping.getName());
assertEquals("Mapping has correct name", "dynamic2", mapping.getName());
assertNotNull("AppConfig has form bean " + mapping.getName(), moduleConfig2.findFormBeanConfig(mapping.getName()));
ActionForm form = RequestUtils.createActionForm(request, mapping, moduleConfig2, null);
assertNotNull("ActionForm returned", form);
assertTrue("ActionForm of correct type", form instanceof DynaActionForm);
}
use of org.apache.struts.action.DynaActionForm in project sonar-java by SonarSource.
the class TestCopyFormToContext method testLookupByNameAndSessionScope.
public void testLookupByNameAndSessionScope() throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "bar";
command.setFormName(formName);
command.setScope("session");
command.setToKey(POST_EXECUTION_CONTEXT_KEY);
assertNull(context.get(POST_EXECUTION_CONTEXT_KEY));
assertNull(context.getRequestScope().get(formName));
assertNull(context.getSessionScope().get(formName));
command.execute(context);
assertNotNull(context.get(POST_EXECUTION_CONTEXT_KEY));
assertNull(context.getRequestScope().get(formName));
assertNotNull(context.getSessionScope().get(formName));
assertSame(context.get(POST_EXECUTION_CONTEXT_KEY), context.getSessionScope().get(formName));
ActionForm theForm = (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
assertTrue(theForm instanceof DynaActionForm);
DynaActionForm dForm = (DynaActionForm) theForm;
assertEquals("test", dForm.get("property"));
}
use of org.apache.struts.action.DynaActionForm in project sonarqube by SonarSource.
the class TestRequestUtils method testCreateActionForm3b.
// Second module -- Dynamic ActionForm should be created
public void testCreateActionForm3b() {
request.setPathElements("/myapp", "/2/dynamic2.do", null, null);
ActionMapping mapping = (ActionMapping) moduleConfig2.findActionConfig("/dynamic2");
assertNotNull("Found /dynamic2 mapping", mapping);
assertNotNull("Mapping has non-null name", mapping.getName());
assertEquals("Mapping has correct name", "dynamic2", mapping.getName());
assertNotNull("AppConfig has form bean " + mapping.getName(), moduleConfig2.findFormBeanConfig(mapping.getName()));
ActionForm form = RequestUtils.createActionForm(request, mapping, moduleConfig2, null);
assertNotNull("ActionForm returned", form);
assertTrue("ActionForm of correct type", form instanceof DynaActionForm);
}
Aggregations