in ti/phase2/jars/core/src/java/org/apache/ti/pageflow/xwork/PageFlowResult.java [312:394]
protected void initFrom(Forward fwd, PageFlowActionContext actionContext, boolean checkForErrors) {
// If there was a path specified on the Forward (programmatically), use that.
// TODO: enforce an annotation attribute that allows this; otherwise, throw.
if (fwd.getPath() != null) {
setLocation(fwd.getPath());
}
// Add query params to the path.
if (fwd.getQueryString() != null) {
setLocation(getLocation() + fwd.getQueryString());
}
Class returnFormClass = null;
if (_outputFormBeanType != null) {
try {
returnFormClass = Class.forName(_outputFormBeanType);
} catch (ClassNotFoundException e) {
// This should never happen -- the JPF compiler ensures that it's a valid class.
assert false : e;
}
}
FlowController flowController = actionContext.getFlowController();
if (_outputFormBeanMember != null) {
try {
assert flowController != null; // should be set in initialize()
Field field = flowController.getClass().getDeclaredField(_outputFormBeanMember);
returnFormClass = field.getType();
if (!Modifier.isPublic(field.getModifiers())) {
field.setAccessible(true);
}
Object form = field.get(flowController);
if (form != null) {
if (_log.isDebugEnabled()) {
_log.debug("using member " + _outputFormBeanMember + " for forward " + getName());
}
fwd.addOutputForm(form);
} else {
if (_log.isInfoEnabled()) {
_log.info("returnFormMember " + _outputFormBeanMember + " was null.");
}
}
} catch (NoSuchFieldException e) {
assert false : "could not find field " + _outputFormBeanMember; // compiler should catch this
} catch (IllegalAccessException e) {
assert false; // should not get here -- field is accessible.
}
}
if (checkForErrors) {
checkOutputFormBeans(fwd, returnFormClass, flowController);
checkActionOutputs(fwd, actionContext);
//
// Throw an exception if this is a redirect, and if there was an output form or an action output added.
// Output forms and action outputs are carried in the request, and will be lost on redirects.
//
if (isRedirect()) {
if ((_actionOutputDeclarations != null) && !_actionOutputDeclarations.isEmpty()) {
FlowControllerException ex = new IllegalActionOutputException(_name, flowController,
(String) _actionOutputDeclarations.keySet()
.iterator()
.next());
InternalUtils.throwPageFlowException(ex);
}
List outputForms = fwd.getOutputFormBeans();
if ((outputForms != null) && !outputForms.isEmpty()) {
FlowControllerException ex = new IllegalRedirectOutputFormException(_name, flowController,
outputForms.get(0).getClass().getName());
InternalUtils.throwPageFlowException(ex);
}
}
}
}