use of lucee.runtime.exp.ApplicationException in project Lucee by lucee.
the class ZipParam method doStartTag.
@Override
public int doStartTag() throws PageException {
if (this.filter == null && !StringUtil.isEmpty(this.pattern)) {
this.filter = new WildcardPatternFilter(pattern, patternDelimiters);
}
if (source != null) {
notAllowed("source", "charset", charset);
notAllowed("source", "content", content);
getZip().setParam(new ZipParamSource(source, entryPath, filter, prefix, recurse()));
} else if (content != null) {
required("content", "entrypath", entryPath);
notAllowed("content,entrypath", "filter", filter);
notAllowed("content,entrypath", "prefix", prefix);
notAllowed("content,entrypath", "source", source);
notAllowed("content,entrypath", "recurse", recurse);
getZip().setParam(new ZipParamContent(content, entryPath, charset));
} else if (filter != null) {
notAllowed("filter", "charset", charset);
notAllowed("filter", "content", content);
notAllowed("filter", "prefix", prefix);
notAllowed("filter", "source", source);
getZip()._setFilter(filter);
// getZip().setParam(new ZipParamFilter(filter,entryPath,recurse()));
} else if (entryPath != null) {
notAllowed("entryPath", "charset", charset);
notAllowed("entryPath", "content", content);
notAllowed("entryPath", "prefix", prefix);
notAllowed("entryPath", "source", source);
getZip().setEntrypath(entryPath);
} else
throw new ApplicationException("invalid attribute combination");
return SKIP_BODY;
}
use of lucee.runtime.exp.ApplicationException in project Lucee by lucee.
the class SOAPUtil method getTypes.
public static Vector getTypes(Element body, SymbolTable st) throws ApplicationException {
// get the data
List<TempType> hrefs = new ArrayList<SOAPUtil.TempType>();
Map<String, TempType> ids = new HashMap<String, SOAPUtil.TempType>();
ArrayList<TempType> res = new ArrayList<SOAPUtil.TempType>();
toTempTypes(XMLUtil.getChildNodes(body, Node.ELEMENT_NODE).iterator(), res, hrefs, ids, res);
// replace href with real data
Iterator<TempType> it = hrefs.iterator();
TempType href, id;
while (it.hasNext()) {
href = it.next();
id = ids.get(href.href);
if (StringUtil.isEmpty(id))
throw new ApplicationException("cannot handle href " + href.href);
href.href = null;
href.id = id.id;
href.prefix = id.prefix;
href.namespace = id.namespace;
href.type = id.type;
href.children = id.children;
id.replicated = true;
}
// removes replicated types in root
it = res.iterator();
TempType t;
while (it.hasNext()) {
t = it.next();
if (t.replicated)
it.remove();
}
// now convert to types
return toTypes(res, false);
}
use of lucee.runtime.exp.ApplicationException 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 lucee.runtime.exp.ApplicationException in project Lucee by lucee.
the class CredentialImpl method toRole.
/**
* convert a Object to a String Array of Roles
* @param oRoles
* @return roles
* @throws PageException
*/
public static String[] toRole(Object oRoles) throws PageException {
if (oRoles instanceof String) {
oRoles = ListUtil.listToArrayRemoveEmpty(oRoles.toString(), ",");
}
if (oRoles instanceof Array) {
Array arrRoles = (Array) oRoles;
String[] roles = new String[arrRoles.size()];
for (int i = 0; i < roles.length; i++) {
roles[i] = Caster.toString(arrRoles.get(i + 1, ""));
}
return roles;
}
throw new ApplicationException("invalid roles definition for tag loginuser");
}
use of lucee.runtime.exp.ApplicationException in project Lucee by lucee.
the class Admin method doGetRemoteClient.
private void doGetRemoteClient() throws PageException {
String url = getString("admin", action, "url");
RemoteClient[] clients = config.getRemoteClients();
RemoteClient client;
for (int i = 0; i < clients.length; i++) {
client = clients[i];
if (client.getUrl().equalsIgnoreCase(url)) {
Struct sct = new StructImpl();
ProxyData pd = client.getProxyData();
sct.setEL("label", client.getLabel());
sct.setEL("usage", client.getUsage());
sct.setEL("securityKey", client.getSecurityKey());
sct.setEL("adminPassword", client.getAdminPassword());
sct.setEL("ServerUsername", client.getServerUsername());
sct.setEL("ServerPassword", client.getServerPassword());
sct.setEL("type", client.getType());
sct.setEL("url", client.getUrl());
sct.setEL("proxyServer", pd == null ? "" : StringUtil.emptyIfNull(pd.getServer()));
sct.setEL("proxyUsername", pd == null ? "" : StringUtil.emptyIfNull(pd.getUsername()));
sct.setEL("proxyPassword", pd == null ? "" : StringUtil.emptyIfNull(pd.getPassword()));
sct.setEL("proxyPort", pd == null ? "" : (pd.getPort() == -1 ? "" : Caster.toString(pd.getPort())));
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
return;
}
}
throw new ApplicationException("there is no remote client with url [" + url + "]");
}
Aggregations