📄 strutsobjectfactory.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: StrutsObjectFactory.java
package org.apache.struts2.impl;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.entities.InterceptorConfig;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.util.OgnlUtil;
import java.util.HashMap;
import java.util.Map;
public class StrutsObjectFactory extends ObjectFactory
{
public StrutsObjectFactory()
{
}
public Interceptor buildInterceptor(InterceptorConfig interceptorConfig, Map refParams)
throws ConfigurationException
{
String className;
Map params;
className = interceptorConfig.getClassName();
params = new HashMap();
Map typeParams = interceptorConfig.getParams();
if (typeParams != null && !typeParams.isEmpty())
params.putAll(typeParams);
if (refParams != null && !refParams.isEmpty())
params.putAll(refParams);
params.putAll(refParams);
Interceptor interceptor;
Object o = buildBean(className, null);
OgnlUtil.setProperties(params, o);
if (!(o instanceof Interceptor))
break MISSING_BLOCK_LABEL_113;
interceptor = (Interceptor)o;
interceptor.init();
return interceptor;
try
{
throw new ConfigurationException((new StringBuilder()).append("Class [").append(className).append("] does not implement Interceptor").toString(), interceptorConfig);
}
catch (InstantiationException e)
{
throw new ConfigurationException((new StringBuilder()).append("Unable to instantiate an instance of Interceptor class [").append(className).append("].").toString(), e, interceptorConfig);
}
catch (IllegalAccessException e)
{
throw new ConfigurationException((new StringBuilder()).append("IllegalAccessException while attempting to instantiate an instance of Interceptor class [").append(className).append("].").toString(), e, interceptorConfig);
}
catch (Exception e)
{
throw new ConfigurationException((new StringBuilder()).append("Caught Exception while registering Interceptor class ").append(className).toString(), e, interceptorConfig);
}
catch (NoClassDefFoundError e)
{
throw new ConfigurationException((new StringBuilder()).append("Could not load class ").append(className).append(". Perhaps it exists but certain dependencies are not available?").toString(), e, interceptorConfig);
}
}
public Result buildResult(ResultConfig resultConfig, Map extraContext)
throws Exception
{
String resultClassName = resultConfig.getClassName();
if (resultClassName == null)
return null;
Object result = buildBean(resultClassName, extraContext);
OgnlUtil.setProperties(resultConfig.getParams(), result, extraContext);
if (result instanceof Result)
return (Result)result;
else
throw new ConfigurationException((new StringBuilder()).append(result.getClass().getName()).append(" does not implement Result.").toString());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -