Search in sources :

Example 1 with ReflectionExceptionHandler

use of com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler in project struts by apache.

the class DefaultResultFactory method buildResult.

public Result buildResult(ResultConfig resultConfig, Map<String, Object> extraContext) throws Exception {
    String resultClassName = resultConfig.getClassName();
    Result result = null;
    if (resultClassName != null) {
        result = (Result) objectFactory.buildBean(resultClassName, extraContext);
        Map<String, String> params = resultConfig.getParams();
        if (params != null) {
            for (Map.Entry<String, String> paramEntry : params.entrySet()) {
                try {
                    reflectionProvider.setProperty(paramEntry.getKey(), paramEntry.getValue(), result, extraContext, true);
                } catch (ReflectionException ex) {
                    if (result instanceof ReflectionExceptionHandler) {
                        ((ReflectionExceptionHandler) result).handle(ex);
                    }
                }
            }
        }
    }
    return result;
}
Also used : ReflectionException(com.opensymphony.xwork2.util.reflection.ReflectionException) ReflectionExceptionHandler(com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler) Map(java.util.Map) Result(com.opensymphony.xwork2.Result)

Aggregations

Result (com.opensymphony.xwork2.Result)1 ReflectionException (com.opensymphony.xwork2.util.reflection.ReflectionException)1 ReflectionExceptionHandler (com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler)1 Map (java.util.Map)1