use of lucee.runtime.net.proxy.ProxyDataImpl in project Lucee by lucee.
the class CreateObject method call.
public static Object call(PageContext pc, String type, String className, Object context, Object serverName) throws PageException {
type = StringUtil.toLowerCase(type);
// JAVA
if (type.equals("java")) {
checkAccess(pc, type);
return doJava(pc, className, context, Caster.toString(serverName));
}
// COM
if (type.equals("com")) {
return doCOM(pc, className);
}
// Component
if (type.equals("component") || type.equals("cfc")) {
return doComponent(pc, className);
}
// Webservice
if (type.equals("webservice") || type.equals("wsdl")) {
String user = null;
String pass = null;
ProxyDataImpl proxy = null;
if (context != null) {
Struct args = (serverName != null) ? Caster.toStruct(serverName) : Caster.toStruct(context);
// basic security
user = Caster.toString(args.get("username", null));
pass = Caster.toString(args.get("password", null));
// proxy
String proxyServer = Caster.toString(args.get("proxyServer", null));
String proxyPort = Caster.toString(args.get("proxyPort", null));
String proxyUser = Caster.toString(args.get("proxyUser", null));
if (StringUtil.isEmpty(proxyUser))
proxyUser = Caster.toString(args.get("proxyUsername", null));
String proxyPassword = Caster.toString(args.get("proxyPassword", null));
if (!StringUtil.isEmpty(proxyServer)) {
proxy = new ProxyDataImpl(proxyServer, Caster.toIntValue(proxyPort, -1), proxyUser, proxyPassword);
}
}
return doWebService(pc, className, user, pass, proxy);
}
if (type.equals("http")) {
String user = null;
String pass = null;
ProxyDataImpl proxy = null;
if (context != null) {
Struct args = (serverName != null) ? Caster.toStruct(serverName) : Caster.toStruct(context);
// basic security
user = Caster.toString(args.get("username", null));
pass = Caster.toString(args.get("password", null));
// proxy
String proxyServer = Caster.toString(args.get("proxyServer", null));
String proxyPort = Caster.toString(args.get("proxyPort", null));
String proxyUser = Caster.toString(args.get("proxyUser", null));
if (StringUtil.isEmpty(proxyUser))
proxyUser = Caster.toString(args.get("proxyUsername", null));
String proxyPassword = Caster.toString(args.get("proxyPassword", null));
if (!StringUtil.isEmpty(proxyServer)) {
proxy = new ProxyDataImpl(proxyServer, Caster.toIntValue(proxyPort, -1), proxyUser, proxyPassword);
}
}
return doHTTP(pc, className, user, pass, proxy);
}
// .net
if (type.equals(".net") || type.equals("dotnet")) {
return doDotNet(pc, className);
}
throw new ExpressionException("Invalid argument for function createObject, first argument (type), " + "must be (com, java, webservice or component) other types are not supported");
}
Aggregations