45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package org.apache.struts.action;
|
|
|
|
import java.util.ArrayList;
|
|
import org.apache.struts.config.ActionConfig;
|
|
import org.apache.struts.config.ExceptionConfig;
|
|
import org.apache.struts.config.ForwardConfig;
|
|
|
|
public class ActionMapping extends ActionConfig {
|
|
public ExceptionConfig findException(Class type) {
|
|
ExceptionConfig config = null;
|
|
do {
|
|
String name = type.getName();
|
|
config = findExceptionConfig(name);
|
|
if (config != null)
|
|
return config;
|
|
config = getModuleConfig().findExceptionConfig(name);
|
|
if (config != null)
|
|
return config;
|
|
type = type.getSuperclass();
|
|
} while (type != null);
|
|
return null;
|
|
}
|
|
|
|
public ActionForward findForward(String name) {
|
|
ForwardConfig config = findForwardConfig(name);
|
|
if (config == null)
|
|
config = getModuleConfig().findForwardConfig(name);
|
|
return (ActionForward)config;
|
|
}
|
|
|
|
public String[] findForwards() {
|
|
ArrayList results = new ArrayList();
|
|
ForwardConfig[] fcs = findForwardConfigs();
|
|
for (int i = 0; i < fcs.length; i++)
|
|
results.add(fcs[i].getName());
|
|
return results.<String>toArray(new String[results.size()]);
|
|
}
|
|
|
|
public ActionForward getInputForward() {
|
|
if (getModuleConfig().getControllerConfig().getInputForward())
|
|
return findForward(getInput());
|
|
return new ActionForward(getInput());
|
|
}
|
|
}
|