use of org.apache.cxf.jaxrs.model.BeanParamInfo in project cxf by apache.
the class ServerProviderFactory method addBeanParamInfo.
public void addBeanParamInfo(BeanParamInfo bpi) {
beanParams.put(bpi.getResourceClass(), bpi);
for (Method m : bpi.getResourceClass().getMethods()) {
if (m.getAnnotation(BeanParam.class) != null) {
BeanParamInfo methodBpi = new BeanParamInfo(m.getParameterTypes()[0], getBus());
addBeanParamInfo(methodBpi);
}
}
for (Field f : bpi.getResourceClass().getDeclaredFields()) {
if (f.getAnnotation(BeanParam.class) != null) {
BeanParamInfo fieldBpi = new BeanParamInfo(f.getType(), getBus());
addBeanParamInfo(fieldBpi);
}
}
}
use of org.apache.cxf.jaxrs.model.BeanParamInfo in project cxf by apache.
the class JAXRSUtils method createBeanParamValue.
public static Object createBeanParamValue(Message m, Class<?> clazz, OperationResourceInfo ori) {
BeanParamInfo bmi = ServerProviderFactory.getInstance(m).getBeanParamInfo(clazz);
if (bmi == null) {
// we could've started introspecting now but the fact no bean info
// is available indicates that the one created at start up has been
// lost and hence it is 500
LOG.warning("Bean parameter info is not available");
throw ExceptionUtils.toInternalServerErrorException(null, null);
}
Object instance;
try {
instance = clazz.newInstance();
} catch (Throwable t) {
throw ExceptionUtils.toInternalServerErrorException(t, null);
}
JAXRSUtils.injectParameters(ori, bmi, instance, m);
InjectionUtils.injectContexts(instance, bmi, m);
return instance;
}
Aggregations