Search in sources :

Example 1 with Gadget

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();
}
Also used : Gadget(org.apache.shindig.gadgets.Gadget) JSONObject(org.json.JSONObject) JsonRpcGadgetContext(org.apache.shindig.gadgets.servlet.JsonRpcGadgetContext) GadgetURLException(com.liferay.opensocial.GadgetURLException) ProcessingException(org.apache.shindig.gadgets.process.ProcessingException)

Aggregations

GadgetURLException (com.liferay.opensocial.GadgetURLException)1 Gadget (org.apache.shindig.gadgets.Gadget)1 ProcessingException (org.apache.shindig.gadgets.process.ProcessingException)1 JsonRpcGadgetContext (org.apache.shindig.gadgets.servlet.JsonRpcGadgetContext)1 JSONObject (org.json.JSONObject)1