use of org.apache.shindig.gadgets.Gadget in project liferay-ide by liferay.
the class ShindigUtil method getGadgetSpec.
public static GadgetSpec getGadgetSpec(String url, boolean debug, boolean ignoreCache) throws Exception {
if (Validator.isNull(url)) {
throw new GadgetURLException();
}
JSONObject gadgetContextJSONObject = new JSONObject();
gadgetContextJSONObject.put("debug", debug);
if (!ignoreCache && _ignoreGadgetSpecCache.contains(url)) {
ignoreCache = true;
}
gadgetContextJSONObject.put("ignoreCache", ignoreCache);
JSONObject gadgetRequestJSONObject = new JSONObject();
gadgetRequestJSONObject.put("url", url);
JsonRpcGadgetContext jsonRpcGadgetContext = new JsonRpcGadgetContext(gadgetContextJSONObject, gadgetRequestJSONObject);
Gadget gadget = null;
try {
gadget = _processor.process(jsonRpcGadgetContext);
_ignoreGadgetSpecCache.remove(url);
} catch (ProcessingException pe) {
_ignoreGadgetSpecCache.add(url);
throw new GadgetURLException(pe);
}
return gadget.getSpec();
}
Aggregations