use of javax.xml.rpc.encoding.TypeMapping in project Lucee by lucee.
the class TypeMappingUtil method registerDefaults.
public static void registerDefaults(TypeMappingRegistry tmr) {
TypeMapping tm = tmr.getDefaultTypeMapping();
if (!tm.isRegistered(QueryBean.class, RPCConstants.QUERY_QNAME))
tm.register(QueryBean.class, RPCConstants.QUERY_QNAME, new BeanSerializerFactory(QueryBean.class, RPCConstants.QUERY_QNAME), new BeanDeserializerFactory(QueryBean.class, RPCConstants.QUERY_QNAME));
// Adding custom string serialization for non printable characters.
tm.register(String.class, RPCConstants.STRING_QNAME, new StringSerializerFactory(String.class, RPCConstants.STRING_QNAME), new StringDeserializerFactory(String.class, RPCConstants.STRING_QNAME));
}
use of javax.xml.rpc.encoding.TypeMapping in project Lucee by lucee.
the class ComponentController method _invoke.
public static Object _invoke(String name, Object[] args) throws PageException {
Key key = Caster.toKey(name);
Component c = component.get();
PageContext p = pagecontext.get();
MessageContext mc = messageContext.get();
if (c == null)
throw new ApplicationException("missing component");
if (p == null)
throw new ApplicationException("missing pagecontext");
UDF udf = Caster.toFunction(c.get(p, key, null), null);
FunctionArgument[] fa = null;
if (udf != null)
fa = udf.getFunctionArguments();
for (int i = 0; i < args.length; i++) {
if (fa != null && i < fa.length && fa[i].getType() == CFTypes.TYPE_UNKNOW) {
args[i] = AxisCaster.toLuceeType(p, fa[i].getTypeAsString(), args[i]);
} else
args[i] = AxisCaster.toLuceeType(p, args[i]);
}
// return type
String rtnType = udf != null ? udf.getReturnTypeAsString() : "any";
Object rtn = c.call(p, key, args);
// cast return value to Axis type
try {
RPCServer server = RPCServer.getInstance(p.getId(), p, p.getServletContext());
TypeMapping tm = mc != null ? mc.getTypeMapping() : TypeMappingUtil.getServerTypeMapping(server.getEngine().getTypeMappingRegistry());
rtn = Caster.castTo(p, rtnType, rtn, false);
Class<?> clazz = Caster.cfTypeToClass(rtnType);
return AxisCaster.toAxisType(tm, rtn, clazz.getComponentType() != null ? clazz : null);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw Caster.toPageException(t);
}
}
use of javax.xml.rpc.encoding.TypeMapping in project Lucee by lucee.
the class ComponentProvider method invokeMethod.
@Override
protected Object invokeMethod(MessageContext mc, Method method, Object trg, Object[] args) throws Exception {
PageContext pc = (PageContext) mc.getProperty(Constants.PAGE_CONTEXT);
Component c = (Component) mc.getProperty(Constants.COMPONENT);
RPCServer server = RPCServer.getInstance(pc.getId(), pc, pc.getServletContext());
// TypeMappingUtil.getServerTypeMapping(server.getEngine().getTypeMappingRegistry());
TypeMapping tm = mc.getTypeMapping();
return AxisCaster.toAxisType(tm, c.call(pc, method.getName(), toLuceeType(pc, args)), null);
}
Aggregations