Class Dispatcher

java.lang.Object
com.morpheusdata.web.Dispatcher

public class Dispatcher extends Object
Dispatcher provides a way for a plugin to handle routes from morpheus-ui to a plugin. A Plugin may render html or json response back to the client.
  • Constructor Details

  • Method Details

    • handleRoute

      public Object handleRoute(String path, Map<String,String> usersPermissions)
      Looks up plugin based on path, checks user permissions and responds.
      Parameters:
      path - - Path of url, eg /myPlugin/myAction
      usersPermissions - - Permissions of the current user
      Returns:
      JsonResponse or TemplateResponse
    • handleRoute

      public Object handleRoute(String path, ViewModel<?> model, Map<String,String> usersPermissions)
      Looks up plugin based on path, checks user permissions and responds per the specified ViewModel
      Parameters:
      path - - Path of url, eg /myPlugin/myAction
      model - - Model to pass to the controller containing the http request objects
      usersPermissions - - Permissions of the current user
      Returns:
      JsonResponse or TemplateResponse
    • doDispatch

      public Object doDispatch(PluginController controller, String methodName, ViewModel<?> params)
      Using reflection, dynamically call the Class and method of a Plugin Controller.
      Parameters:
      controller - Plugin Controller
      methodName - Name of method to call in Plugin Controller Class
      params - ViewModel to pass to the controller containing request/response and params.
      Returns:
      JsonResponse or TemplateResponse