Package com.morpheusdata.web
Class Dispatcher
java.lang.Object
com.morpheusdata.web.Dispatcher
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiondoDispatch
(PluginController controller, String methodName, ViewModel<?> params) Using reflection, dynamically call the Class and method of a Plugin Controller.Looks up plugin based on path, checks user permissions and responds per the specified ViewModelhandleRoute
(String path, Map<String, String> usersPermissions) Looks up plugin based on path, checks user permissions and responds.
-
Constructor Details
-
Dispatcher
-
-
Method Details
-
handleRoute
Looks up plugin based on path, checks user permissions and responds.- Parameters:
path
- - Path of url, eg /myPlugin/myActionusersPermissions
- - Permissions of the current user- Returns:
- JsonResponse or TemplateResponse
-
handleRoute
Looks up plugin based on path, checks user permissions and responds per the specified ViewModel- Parameters:
path
- - Path of url, eg /myPlugin/myActionmodel
- - Model to pass to the controller containing the http request objectsusersPermissions
- - Permissions of the current user- Returns:
- JsonResponse or TemplateResponse
-
doDispatch
Using reflection, dynamically call the Class and method of a Plugin Controller.- Parameters:
controller
- Plugin ControllermethodName
- Name of method to call in Plugin Controller Classparams
- ViewModel to pass to the controller containing request/response and params.- Returns:
- JsonResponse or TemplateResponse
-