use of org.apache.struts.config.ForwardConfig in project sonar-java by SonarSource.
the class AbstractPerformForward method execute.
// ---------------------------------------------------------- Public Methods
/**
* <p>Perform forwarding or redirection based on the specified
* <code>ActionForward</code> (if any).</p>
*
* @param actionCtx The <code>Context</code> for the current request
* @return <code>true</code> so that processing completes
* @throws Exception if thrown by the <code>Action</code>
*/
public boolean execute(ActionContext actionCtx) throws Exception {
// Is there a ForwardConfig to be performed?
ForwardConfig forwardConfig = actionCtx.getForwardConfig();
if (forwardConfig == null) {
return (false);
}
// Perform the appropriate processing on this ActionForward
perform(actionCtx, forwardConfig);
return (true);
}
use of org.apache.struts.config.ForwardConfig 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.ForwardConfig in project sonar-java by SonarSource.
the class TagTestBase method setUp.
/**
* Helper method that creates/configures a basic configuration of Mock
* Objects.
*
* PageContext ServletConfig ServletContext HttpServletRequest HttpSession
* HttpServletResponse
*
* "/myapp", "/foo", null, null,
*/
public void setUp() {
// -- default Module
this.moduleConfig = new ModuleConfigImpl("");
this.moduleConfig.addForwardConfig(new ForwardConfig("foo", "/bar.jsp", false));
this.moduleConfig.addForwardConfig(new ForwardConfig("relative1", "relative.jsp", false));
this.moduleConfig.addForwardConfig(new ForwardConfig("relative2", "relative.jsp", false));
this.moduleConfig.addForwardConfig(new ForwardConfig("external", "http://struts.apache.org/", false));
// -- module "/2"
this.moduleConfig2 = new ModuleConfigImpl("/2");
this.moduleConfig2.addForwardConfig(new ForwardConfig("foo", "/baz.jsp", false));
this.moduleConfig2.addForwardConfig(new ForwardConfig("relative1", "relative.jsp", false));
this.moduleConfig2.addForwardConfig(new ForwardConfig("relative2", "relative.jsp", false));
this.moduleConfig2.addForwardConfig(new ForwardConfig("external", "http://struts.apache.org/", false));
// -- module "/3"
this.moduleConfig3 = new ModuleConfigImpl("/3");
// -- configure the ServletContext
this.servletContext = new MockServletContext();
this.servletContext.setAttribute(Globals.MODULE_KEY, moduleConfig);
this.servletContext.setAttribute(Globals.MODULE_KEY + "/2", moduleConfig2);
this.servletContext.setAttribute(Globals.MODULE_KEY + "/3", moduleConfig3);
// -- configure the ServletConfig
this.servletConfig = new MockServletConfig();
this.servletConfig.setServletContext(servletContext);
// -- configure the request
this.request = new MockHttpServletRequest(new MockHttpSession());
pageContext = new MockPageContext(servletConfig, request, new MockHttpServletResponse());
}
Aggregations