use of org.apache.struts.config.ActionConfig in project sonar-java by SonarSource.
the class AbstractExecuteAction method execute.
// ---------------------------------------------------------- Public Methods
/**
* <p>Invoke the appropriate <code>Action</code> for this request, and
* cache the returned <code>ActionForward</code>.</p>
*
* @param actionCtx The <code>Context</code> for the current request
* @return <code>false</code> so that processing continues
* @throws Exception if thrown by the Action class
*/
public boolean execute(ActionContext actionCtx) throws Exception {
// Skip processing if the current request is not valid
Boolean valid = actionCtx.getFormValid();
if ((valid == null) || !valid.booleanValue()) {
return (false);
}
// Acquire the resources we will need to send to the Action
Action action = actionCtx.getAction();
if (action == null) {
return (false);
}
ActionConfig actionConfig = actionCtx.getActionConfig();
ActionForm actionForm = actionCtx.getActionForm();
// Execute the Action for this request, caching returned ActionForward
ForwardConfig forwardConfig = execute(actionCtx, action, actionConfig, actionForm);
actionCtx.setForwardConfig(forwardConfig);
return (false);
}
use of org.apache.struts.config.ActionConfig in project sonar-java by SonarSource.
the class AbstractSelectForward method execute.
// ---------------------------------------------------------- Public Methods
/**
* <p>Select and cache the <code>ActionForward</code> for this
* <code>ActionConfig</code> if specified.</p>
*
* @param actionCtx The <code>Context</code> for the current request
* @return <code>false</code> so that processing continues
* @throws Exception if thrown by the Action class
*/
public boolean execute(ActionContext actionCtx) throws Exception {
// Skip processing if the current request is not valid
Boolean valid = actionCtx.getFormValid();
if ((valid == null) || !valid.booleanValue()) {
return (false);
}
// Acquire configuration objects that we need
ActionConfig actionConfig = actionCtx.getActionConfig();
ModuleConfig moduleConfig = actionConfig.getModuleConfig();
ForwardConfig forwardConfig = null;
String forward = actionConfig.getForward();
if (forward != null) {
forwardConfig = forward(actionCtx, moduleConfig, forward);
if (LOG.isDebugEnabled()) {
LOG.debug("Forwarding to " + forwardConfig);
}
actionCtx.setForwardConfig(forwardConfig);
}
return (false);
}
use of org.apache.struts.config.ActionConfig in project sonar-java by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean1.
// use servlet mapping (extension mapping)
public void testString_getActionMappingURL_String_String_PageContext_boolean1() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "*.do");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/myapp", "/baz.do", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/foo", pageContext), "/myapp/foo.do");
}
use of org.apache.struts.config.ActionConfig in project sonar-java by SonarSource.
the class TestTagUtils method testComputeURLCharacterEncodingAction.
public void testComputeURLCharacterEncodingAction() {
ActionConfig actionConfig = new ActionConfig();
actionConfig.setName("baz");
actionConfig.setPath("/baz");
moduleConfig.addActionConfig(actionConfig);
request.setPathElements("/myapp", "/foo.do", null, null);
Map map = new HashMap();
map.put("foo1", "bar1");
map.put("foo2", "bar2");
String url = null;
try {
url = tagutils.computeURL(pageContext, null, null, null, "baz", null, map, "anchor", false);
} catch (MalformedURLException e) {
fail("MalformedURLException: " + e);
}
assertNotNull("url present", url);
assertTrue("url value", url.equals("/myapp/baz?foo1=bar1&foo2=bar2#anchor") || url.equals("/myapp/baz?foo2=bar2&foo1=bar1#anchor"));
}
use of org.apache.struts.config.ActionConfig in project sonar-java by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean3.
// use servlet mapping (extension mapping)
// -- path as "/"
// (this is probably not a realistic use case)
public void testString_getActionMappingURL_String_String_PageContext_boolean3() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "*.do");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/mycontext", "/baz", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/", pageContext), "/mycontext/.do");
}
Aggregations