use of lucee.runtime.exp.PageRuntimeException in project Lucee by lucee.
the class HTTPClient method getMetaData.
private Struct getMetaData(PageContext pc) {
if (meta == null) {
pc = ThreadLocalPageContext.get(pc);
InputStream is = null;
HTTPResponse rsp = null;
try {
rsp = HTTPEngine.get(metaURL, username, password, -1, false, "UTF-8", createUserAgent(pc), proxyData, null);
MimeType mt = getMimeType(rsp, null);
int format = MimeType.toFormat(mt, -1);
if (format == -1)
throw new ApplicationException("cannot convert response with mime type [" + mt + "] to a CFML Object");
is = rsp.getContentAsStream();
Struct data = Caster.toStruct(ReqRspUtil.toObject(pc, IOUtil.toBytes(is, false), format, mt.getCharset(), null));
Object oUDF = data.get(KeyConstants._functions, null);
Object oAACF = data.get(ComponentPageImpl.ACCEPT_ARG_COLL_FORMATS, null);
if (oUDF != null && oAACF != null) {
meta = Caster.toStruct(oUDF);
String[] strFormats = ListUtil.listToStringArray(Caster.toString(oAACF), ',');
argumentsCollectionFormat = UDFUtil.toReturnFormat(strFormats, UDF.RETURN_FORMAT_JSON);
} else {
meta = data;
}
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw new PageRuntimeException(Caster.toPageException(t));
} finally {
IOUtil.closeEL(is);
HTTPEngine.closeEL(rsp);
}
}
return meta;
}
use of lucee.runtime.exp.PageRuntimeException in project Lucee by lucee.
the class XMLDocumentStruct method setXmlStandalone.
// used only with java 7, do not set @Override
public void setXmlStandalone(boolean arg0) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("setXmlStandalone", new Class[] { boolean.class });
m.invoke(doc, new Object[] { Caster.toBoolean(arg0) });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
use of lucee.runtime.exp.PageRuntimeException in project Lucee by lucee.
the class XMLDocumentStruct method setXmlVersion.
// used only with java 7, do not set @Override
public void setXmlVersion(String arg0) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("setXmlVersion", new Class[] { arg0.getClass() });
m.invoke(doc, new Object[] { arg0 });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
use of lucee.runtime.exp.PageRuntimeException in project Lucee by lucee.
the class XMLDocumentStruct method normalizeDocument.
// used only with java 7, do not set @Override
public void normalizeDocument() {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("normalizeDocument", new Class[] {});
m.invoke(doc, ArrayUtil.OBJECT_EMPTY);
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
use of lucee.runtime.exp.PageRuntimeException in project Lucee by lucee.
the class XMLDocumentStruct method setDocumentURI.
// used only with java 7, do not set @Override
public void setDocumentURI(String arg0) {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("setDocumentURI", new Class[] { arg0.getClass() });
m.invoke(doc, new Object[] { arg0 });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
Aggregations