use of org.apache.struts.config.ForwardConfig in project sonarqube by SonarSource.
the class ActionServlet method processActionConfigExtension.
/**
* <p>Extend the action's configuration as necessary.</p>
*
* @param actionConfig the configuration to process.
* @param moduleConfig the module configuration for this module.
* @throws ServletException if initialization cannot be performed.
*/
protected void processActionConfigExtension(ActionConfig actionConfig, ModuleConfig moduleConfig) throws ServletException {
try {
if (!actionConfig.isExtensionProcessed()) {
if (log.isDebugEnabled()) {
log.debug("Processing extensions for '" + actionConfig.getPath() + "'");
}
actionConfig = processActionConfigClass(actionConfig, moduleConfig);
actionConfig.processExtends(moduleConfig);
}
// Process forwards extensions.
ForwardConfig[] forwards = actionConfig.findForwardConfigs();
for (int i = 0; i < forwards.length; i++) {
ForwardConfig forward = forwards[i];
processForwardExtension(forward, moduleConfig, actionConfig);
}
// Process exception extensions.
ExceptionConfig[] exceptions = actionConfig.findExceptionConfigs();
for (int i = 0; i < exceptions.length; i++) {
ExceptionConfig exception = exceptions[i];
processExceptionExtension(exception, moduleConfig, actionConfig);
}
} catch (ServletException e) {
throw e;
} catch (Exception e) {
handleGeneralExtensionException("Action", actionConfig.getPath(), e);
}
}
use of org.apache.struts.config.ForwardConfig in project sonarqube by SonarSource.
the class ActionMapping method findForwards.
/**
* <p>Return the logical names of all locally defined forwards for this
* mapping. If there are no such forwards, a zero-length array is
* returned.</p>
*
* @return The forward names for this action mapping.
*/
public String[] findForwards() {
ArrayList results = new ArrayList();
ForwardConfig[] fcs = findForwardConfigs();
for (int i = 0; i < fcs.length; i++) {
results.add(fcs[i].getName());
}
return ((String[]) results.toArray(new String[results.size()]));
}
use of org.apache.struts.config.ForwardConfig in project sonarqube by SonarSource.
the class AbstractSelectInput method execute.
// ---------------------------------------------------------- Public Methods
/**
* <p>Select and cache a <code>ForwardConfig</code> for the input page for
* the current request.</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 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();
// Cache an ForwardConfig back to our input page
ForwardConfig forwardConfig;
String input = actionConfig.getInput();
if (moduleConfig.getControllerConfig().getInputForward()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Finding ForwardConfig for '" + input + "'");
}
forwardConfig = actionConfig.findForwardConfig(input);
if (forwardConfig == null) {
forwardConfig = moduleConfig.findForwardConfig(input);
}
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("Delegating to forward() for '" + input + "'");
}
forwardConfig = forward(actionCtx, moduleConfig, input);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Forwarding back to " + forwardConfig);
}
actionCtx.setForwardConfig(forwardConfig);
return (false);
}
use of org.apache.struts.config.ForwardConfig in project sonarqube by SonarSource.
the class AbstractExceptionHandler 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> if a <code>ForwardConfig</code> is returned,
* else <code>true</code> to complete processing
* @throws Exception if thrown by the Action class and not declared by an
* Exception Handler
*/
public boolean execute(ActionContext actionCtx) throws Exception {
// Look up the exception that was thrown
Exception exception = actionCtx.getException();
if (exception == null) {
LOG.warn("No Exception found in ActionContext");
return (true);
}
// Look up the local or global exception handler configuration
ExceptionConfig exceptionConfig = null;
ActionConfig actionConfig = actionCtx.getActionConfig();
ModuleConfig moduleConfig = actionCtx.getModuleConfig();
if (actionConfig != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("See if actionConfig " + actionConfig + " has an exceptionConfig for " + exception.getClass().getName());
}
exceptionConfig = actionConfig.findException(exception.getClass());
} else if (moduleConfig != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("No action yet, see if moduleConfig " + moduleConfig + " has an exceptionConfig " + exception.getClass().getName());
}
exceptionConfig = moduleConfig.findException(exception.getClass());
}
// Handle the exception in the configured manner
if (exceptionConfig == null) {
LOG.warn("Unhandled exception", exception);
throw exception;
}
ForwardConfig forwardConfig = handle(actionCtx, exception, exceptionConfig, actionConfig, moduleConfig);
if (forwardConfig != null) {
actionCtx.setForwardConfig(forwardConfig);
return (false);
} else {
return (true);
}
}
use of org.apache.struts.config.ForwardConfig in project sonarqube by SonarSource.
the class ModuleConfigImpl method freeze.
/**
* <p> Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return an
* IllegalStateException. </p>
*/
public void freeze() {
super.freeze();
ActionConfig[] aconfigs = findActionConfigs();
for (int i = 0; i < aconfigs.length; i++) {
aconfigs[i].freeze();
}
matcher = new ActionConfigMatcher(aconfigs);
getControllerConfig().freeze();
ExceptionConfig[] econfigs = findExceptionConfigs();
for (int i = 0; i < econfigs.length; i++) {
econfigs[i].freeze();
}
FormBeanConfig[] fbconfigs = findFormBeanConfigs();
for (int i = 0; i < fbconfigs.length; i++) {
fbconfigs[i].freeze();
}
ForwardConfig[] fconfigs = findForwardConfigs();
for (int i = 0; i < fconfigs.length; i++) {
fconfigs[i].freeze();
}
MessageResourcesConfig[] mrconfigs = findMessageResourcesConfigs();
for (int i = 0; i < mrconfigs.length; i++) {
mrconfigs[i].freeze();
}
PlugInConfig[] piconfigs = findPlugInConfigs();
for (int i = 0; i < piconfigs.length; i++) {
piconfigs[i].freeze();
}
}
Aggregations