Example usage for com.liferay.portal.kernel.jsonwebservice JSONWebServiceActionsManagerUtil unregisterJSONWebServiceActions

List of usage examples for com.liferay.portal.kernel.jsonwebservice JSONWebServiceActionsManagerUtil unregisterJSONWebServiceActions

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.jsonwebservice JSONWebServiceActionsManagerUtil unregisterJSONWebServiceActions.

Prototype

public static int unregisterJSONWebServiceActions(String contextPath) 

Source Link

Usage

From source file:com.liferay.alloy.mvc.jsonwebservice.AlloyControllerInvokerManager.java

License:Open Source License

public void registerController(ThemeDisplay themeDisplay, AlloyPortlet alloyPortlet, Portlet portlet,
        String controller, Class<? extends AlloyController> controllerClass) {

    if (_locked) {
        return;/*from   w  w  w.  j  a  va 2 s.co  m*/
    }

    if (_alloyControllerInvokers.containsKey(controller)) {
        AlloyControllerInvoker alloyControllerInvoker = _alloyControllerInvokers.get(controller);

        JSONWebServiceActionsManagerUtil.unregisterJSONWebServiceActions(alloyControllerInvoker);
    }

    Class<? extends AlloyControllerInvoker> alloyControllerInvokerClass = null;

    AlloyControllerInvoker alloyControllerInvoker = null;

    try {
        alloyControllerInvokerClass = createAlloyControllerInvokerClass(controllerClass);

        Constructor<? extends AlloyControllerInvoker> constructor = alloyControllerInvokerClass
                .getConstructor();

        alloyControllerInvoker = constructor.newInstance();

        alloyControllerInvoker.setProperties(themeDisplay, alloyPortlet, portlet, controller, controllerClass);

        _alloyControllerInvokers.put(controller, alloyControllerInvoker);
    } catch (NoClassNecessaryException ncne) {
        return;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    for (Method method : alloyControllerInvokerClass.getDeclaredMethods()) {
        JSONWebServiceActionsManagerUtil.registerJSONWebServiceAction(_contextName, _contextPath,
                alloyControllerInvoker, alloyControllerInvokerClass, method, getAPIPath(controller, method),
                "GET");
    }
}

From source file:com.liferay.alloy.mvc.jsonwebservice.AlloyControllerInvokerManager.java

License:Open Source License

public void unregisterControllers() {
    _locked = true;/* www .  j a  v  a2 s .c  o m*/

    for (Map.Entry<String, AlloyControllerInvoker> entry : _alloyControllerInvokers.entrySet()) {

        String controller = entry.getKey();

        synchronized (controller.intern()) {
            AlloyControllerInvoker alloyControllerInvoker = entry.getValue();

            JSONWebServiceActionsManagerUtil.unregisterJSONWebServiceActions(alloyControllerInvoker);
        }
    }

    _alloyControllerInvokers.clear();
}