本文整理了Java中org.apache.cxf.jaxrs.utils.ResourceUtils.createConstructorArguments
方法的一些代码示例,展示了ResourceUtils.createConstructorArguments
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceUtils.createConstructorArguments
方法的具体详情如下:
包路径:org.apache.cxf.jaxrs.utils.ResourceUtils
类名称:ResourceUtils
方法名:createConstructorArguments
暂无
代码示例来源:origin: apache/cxf
public static Object[] createConstructorArguments(Constructor<?> c,
Message m,
boolean perRequest,
Map<Class<?>, Object> contextValues) {
Class<?>[] params = c.getParameterTypes();
Annotation[][] anns = c.getParameterAnnotations();
Type[] genericTypes = c.getGenericParameterTypes();
return createConstructorArguments(c, m, perRequest, contextValues, params, anns, genericTypes);
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
/**
* {@inheritDoc}
*/
public Object getInstance(Message m) {
Object[] values = ResourceUtils.createConstructorArguments(c, m);
Object instance = values.length > 0 ? ac.getBean(beanId, values) : ac.getBean(beanId);
initInstance(m, instance);
return instance;
}
代码示例来源:origin: apache/cxf
Object[] cArgs = ResourceUtils.createConstructorArguments(c, null, false, values);
if (existingProxies != null && existingProxies.size() <= paramTypes.length) {
for (int i = 0; i < paramTypes.length; i++) {
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public Object getInstance(Message m) {
//TODO -- This is not the BP way.
Object[] values = ResourceUtils.createConstructorArguments(c, m);
//TODO Very springish...
Object instance = values.length > 0 ? blueprintContainer.getComponentInstance(beanId)
: blueprintContainer.getComponentInstance(beanId);
if (!isSingleton || m == null) {
InjectionUtils.invokeLifeCycleMethod(instance, postConstructMethod);
}
return instance;
}
代码示例来源:origin: apache/cxf
/**
* {@inheritDoc}
*/
public Object getInstance(Message m) {
if (singletonInstance != null) {
return singletonInstance;
}
ProviderInfo<?> application = m == null ? null
: (ProviderInfo<?>)m.getExchange().getEndpoint().get(Application.class.getName());
Map<Class<?>, Object> mapValues = CastUtils.cast(application == null ? null
: Collections.singletonMap(Application.class, application.getProvider()));
Object[] values = ResourceUtils.createConstructorArguments(c, m, !isSingleton(), mapValues);
Object instance = values.length > 0 ? ac.getBean(beanId, values) : ac.getBean(beanId);
initInstance(m, instance);
return instance;
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
protected Object createInstance(Message m) {
Object[] values = ResourceUtils.createConstructorArguments(c, m);
try {
Object instance = values.length > 0 ? c.newInstance(values) : c.newInstance(new Object[]{});
InjectionUtils.invokeLifeCycleMethod(instance, postConstructMethod);
return instance;
} catch (InstantiationException ex) {
String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
} catch (IllegalAccessException ex) {
String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated"
+ " due to IllegalAccessException";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
} catch (InvocationTargetException ex) {
Response r = JAXRSUtils.convertFaultToResponse(ex.getCause(), m);
if (r != null) {
m.getExchange().put(Response.class, r);
throw new WebApplicationException();
}
String msg = "Resource class "
+ c.getDeclaringClass().getName() + " can not be instantiated"
+ " due to InvocationTargetException";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
}
}
代码示例来源:origin: apache/cxf
protected Object createInstance(Message m) {
ProviderInfo<?> application =
(ProviderInfo<?>)m.getExchange().getEndpoint().get(Application.class.getName());
Map<Class<?>, Object> mapValues = CastUtils.cast(application == null ? null
: Collections.singletonMap(Application.class, application.getProvider()));
Object[] values = ResourceUtils.createConstructorArguments(c, m, true, mapValues, params, anns, genericTypes);
try {
Object instance = values.length > 0 ? c.newInstance(values) : c.newInstance(new Object[]{});
InjectionUtils.invokeLifeCycleMethod(instance, postConstructMethod);
return instance;
} catch (InstantiationException ex) {
String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
} catch (IllegalAccessException ex) {
String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated"
+ " due to IllegalAccessException";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
} catch (InvocationTargetException ex) {
Response r = JAXRSUtils.convertFaultToResponse(ex.getCause(), m);
if (r != null) {
m.getExchange().put(Response.class, r);
throw new WebApplicationException();
}
String msg = "Resource class "
+ c.getDeclaringClass().getName() + " can not be instantiated"
+ " due to InvocationTargetException";
throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
}
}
代码示例来源:origin: apache/cxf
public void init(Endpoint ep) {
if (resourceInstance instanceof Constructor) {
Constructor<?> c = (Constructor<?>)resourceInstance;
Message m = new MessageImpl();
ExchangeImpl exchange = new ExchangeImpl();
exchange.put(Endpoint.class, ep);
m.setExchange(exchange);
Object[] values =
ResourceUtils.createConstructorArguments(c, m, false, Collections.emptyMap());
try {
resourceInstance = values.length > 0 ? c.newInstance(values) : c.newInstance(new Object[]{});
} catch (Exception ex) {
throw new ServiceConstructionException(ex);
}
}
if (callPostConstruct) {
InjectionUtils.invokeLifeCycleMethod(resourceInstance,
ResourceUtils.findPostConstructMethod(ClassHelper.getRealClass(resourceInstance)));
}
}
代码示例来源:origin: apache/cxf
public Object getInstance(Message m) {
//TODO -- This is not the BP way.
ProviderInfo<?> application = m == null ? null
: (ProviderInfo<?>)m.getExchange().getEndpoint().get(Application.class.getName());
Map<Class<?>, Object> mapValues = CastUtils.cast(application == null ? null
: Collections.singletonMap(Application.class, application.getProvider()));
Object[] values = ResourceUtils.createConstructorArguments(c, m, !isSingleton(), mapValues);
//TODO Very springish...
Object instance = values.length > 0 ? blueprintContainer.getComponentInstance(beanId)
: blueprintContainer.getComponentInstance(beanId);
if (!isSingleton() || m == null) {
InjectionUtils.invokeLifeCycleMethod(instance, postConstructMethod);
}
return instance;
}
内容来源于网络,如有侵权,请联系作者删除!