Package nl.gx.webmanager.springmvc
Interface DelegatedController
-
- All Known Implementing Classes:
nl.gx.webmanager.cms.core.implementation.CmsItemBase
,ComponentController
,ElementBase
,ElementComponentController
,ExtensionSubTabController
,ExtensionSubTabFBO
,FormBindableBase
,nl.gx.webmanager.cms.element.implementation.JcrElementBase
,nl.gx.webmanager.cms.core.implementation.JcrPageMetaDataBase
,MediaItemBase
,MediaItemComponentController
,PageMetaDataBase
,PageMetaDataComponentController
,PanelBase
,PanelComponentController
,PanelTabFBO
,PanelTabset
public interface DelegatedController
This class holds the interface for a class to which controller logic will be delegated. The platform controllers, running within the Spring application context and registered in the springmvc-servlet.xml will delegate the methods contained by this interface to the class implementing the interface. A class implementing this interface will never run inside the Spring application context but controller methods will be delegated by the platform controllers that do.- Author:
- ivol
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addValidator(org.springframework.validation.Validator validator)
Set the Validators for this controller.Object
formBackingObject(javax.servlet.http.HttpServletRequest request)
Returns the form backing object to be used for this controllerLinkedHashMap<DelegatedController,FormBackingObject>
getControllerDelegationMap()
Return the map of delegated controllers of this controller.EditView
getEditView()
Returns the default EditView that should be used for form display.EditView
getEditViewByValue(String value)
Returns the indicated EditView that should be used for form(part) display.ArrayList<String>
getResourceBaseNames()
Return the resource base names for this controllerorg.springframework.validation.Validator[]
getValidators()
Return the Validators for this controller.void
initBinder(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.ServletRequestDataBinder binder)
Callback for additional binder initialisations.void
initialize(javax.servlet.http.HttpServletRequest request)
Called by the framework to initialize the controllervoid
onBind(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.BindException errors)
Callback for custom post-processing in terms of binding.void
onBindAndValidate(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.BindException errors)
Callback for custom post-processing in terms of binding and validation.void
onSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object command, org.springframework.validation.BindException errors, org.springframework.web.servlet.ModelAndView modelAndView)
Callback for the data processing of the form submissed data.Map<String,Object>
referenceData(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.Errors errors)
Callback to createa a reference data map for the given request and command.org.springframework.web.servlet.ModelAndView
showForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.validation.BindException errors, Map controlModel)
Callback for returning the model and view for a GET request.
-
-
-
Method Detail
-
initialize
void initialize(javax.servlet.http.HttpServletRequest request)
Called by the framework to initialize the controller- Parameters:
request
-
-
formBackingObject
Object formBackingObject(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
Returns the form backing object to be used for this controller- Parameters:
request
- current http request- Returns:
- The form backing object to be used for this controller
- Throws:
javax.servlet.ServletException
- in case of errors
-
initBinder
void initBinder(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.ServletRequestDataBinder binder) throws Exception
Callback for additional binder initialisations. called by the WebmanagerController at form submission equivalent to org.springframework.web.servlet.mvc.SimpleFormController.initBinder(); called before the databinding to the commandobject.- Parameters:
request
- current HTTP requestbinder
- binder instance- Throws:
Exception
- in case of invalid state or arguments
-
onBind
void onBind(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.BindException errors) throws Exception
Callback for custom post-processing in terms of binding. called by the WebmanagerController at form submission equivalent to org.springframework.web.servlet.mvc.SimpleFormController.onBind(); called after the databinding to the commandobject.- Parameters:
request
- current HTTP requestcommand
- the command object to perform further binding onerrors
- validation and binder errors holder, allowing for additional custom registration of binding errors- Throws:
Exception
- in case of invalid state or arguments
-
onBindAndValidate
void onBindAndValidate(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.BindException errors) throws Exception
Callback for custom post-processing in terms of binding and validation. called by the WebmanagerController at form submission equivalent to org.springframework.web.servlet.mvc.SimpleFormController.onBindAndValidate(); called after the validate(), also in case of validation and/or bind errors- Parameters:
request
- current HTTP requestcommand
- the command object, still allowing for further bindingerrors
- errors holder, allowing for additional custom validation errors- Throws:
Exception
- in case of invalid state or arguments
-
onSubmit
void onSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object command, org.springframework.validation.BindException errors, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception
Callback for the data processing of the form submissed data. called by the framework at form submission. Note that it is called only if NO ERRORS are raised during binding and validation of ALL components called after onBindAndValidate() The callback provides the ModelAndView of the main spring controller, running inside the Spring application context.- Parameters:
request
- current servlet requestresponse
- current servlet responsecommand
- command object with request parameters bound onto iterrors
- errors holder without errors (subclass can add errors if it wants to)modelAndView
- model and view of the original main spring controller which handles the request- Throws:
Exception
- in case of errors
-
showForm
org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.validation.BindException errors, Map controlModel) throws Exception
Callback for returning the model and view for a GET request. The model of the main spring controller is passed such that properties can also be added to the main model. The returned ModelAndView is added to the edit context for the form backing object of the controller.- Parameters:
request
- current servlet requestresponse
- current servlet responseerrors
- errors holder without errors (subclass can add errors if it wants to)controlModel
- Current model of the controller- Returns:
- The model and view to be rendered by this controller
- Throws:
Exception
- in case of errors
-
referenceData
Map<String,Object> referenceData(javax.servlet.http.HttpServletRequest request, Object command, org.springframework.validation.Errors errors) throws Exception
Callback to createa a reference data map for the given request and command. consisting of bean name/bean instance pairs as expected by ModelAndView. called by the WebmanagerController at a GET equivalent to org.springframework.web.servlet.mvc.SimpleFormController.referenceData();- Parameters:
request
- current HTTP requestcommand
- command objecterrors
- Errors holder- Returns:
- a Map with reference data entries, or
null
if none - Throws:
Exception
- in case of invalid state or arguments- See Also:
ModelAndView
-
getEditView
EditView getEditView()
Returns the default EditView that should be used for form display.- Returns:
- the default EditView that should be used for form display.
-
getEditViewByValue
EditView getEditViewByValue(String value)
Returns the indicated EditView that should be used for form(part) display.- Parameters:
value
- Value of the view that should be used- Returns:
- the indicated view that should be used for form display.
-
addValidator
void addValidator(org.springframework.validation.Validator validator)
Set the Validators for this controller. The Validator must support the specified command class.- Parameters:
validators
- Array of validators to set
-
getValidators
org.springframework.validation.Validator[] getValidators()
Return the Validators for this controller.- Returns:
- Array of validators set on this controller
-
getResourceBaseNames
ArrayList<String> getResourceBaseNames()
Return the resource base names for this controller- Returns:
- the resource base names for this controller
-
getControllerDelegationMap
LinkedHashMap<DelegatedController,FormBackingObject> getControllerDelegationMap()
Return the map of delegated controllers of this controller. This means controller delegation works recursively; a delegated controller itself in his turn can delegate to its own delegated controller- Returns:
- The map of delegated controllers to their form backing objects of this controller
-
-