API for each controller in a Grails application.
Modifiers | Name | Description |
---|---|---|
protected static java.lang.String |
BIND_DATA_METHOD |
|
protected static java.lang.String |
RENDER_METHOD_NAME |
|
protected static java.lang.String |
SLASH |
|
protected ForwardMethod |
forwardMethod |
|
protected RedirectDynamicMethod |
redirect |
|
protected RenderDynamicMethod |
render |
|
protected WithFormMethod |
withFormMethod |
Fields inherited from class | Fields |
---|---|
class CommonWebApi |
RAW_CODEC_NAME |
Constructor and description |
---|
ControllersApi
() |
ControllersApi
(GrailsPluginManager pluginManager) |
Type | Name and description |
---|---|
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource, java.util.List excludes) |
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource, java.util.List excludes, java.lang.String filter) |
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource, java.util.Map includeExclude) |
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource, java.lang.String filter) |
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource) |
java.lang.Object |
bindData(java.lang.Object instance, java.lang.Object target, java.lang.Object bindingSource, java.util.Map includeExclude, java.lang.String filter) |
void |
bindData(java.lang.Object instance, java.lang.Class<T> targetType, java.util.Collection<T> collectionToPopulate, javax.servlet.ServletRequest request) |
void |
bindData(java.lang.Object instance, java.lang.Class<T> targetType, java.util.Collection<T> collectionToPopulate, CollectionDataBindingSource collectionBindingSource) |
java.lang.Object |
chain(java.lang.Object instance, java.util.Map args) Invokes the chain method for the given arguments |
java.lang.String |
forward(java.lang.Object instance, java.util.Map params) Forwards a request for the given parameters using the RequestDispatchers forward method |
java.lang.String |
getActionUri(java.lang.Object instance) Returns the URI of the currently executing action |
java.util.Map |
getChainModel(java.lang.Object instance) Obtains the chain model which is used to chain request attributes from one request to the next via flash scope |
java.lang.String |
getControllerUri(java.lang.Object instance) Returns the URI of the currently executing controller |
org.springframework.validation.Errors |
getErrors(java.lang.Object instance) Obtains the errors instance for the current controller |
java.lang.reflect.Method |
getExceptionHandlerMethodFor(java.lang.Object controllerInstance, java.lang.Class<? extends java.lang.Exception> exceptionType) |
org.springframework.web.servlet.ModelAndView |
getModelAndView(java.lang.Object instance) Obtains the ModelAndView for the currently executing controller |
static org.springframework.context.ApplicationContext |
getStaticApplicationContext() |
java.lang.String |
getTemplateUri(java.lang.Object instance, java.lang.String name) Obtains a URI of a template by name |
java.lang.String |
getViewUri(java.lang.Object instance, java.lang.String name) Obtains a URI of a view by name |
boolean |
hasErrors(java.lang.Object instance) Return true if there are an errors |
void |
header(java.lang.Object instance, java.lang.String headerName, java.lang.Object headerValue) Sets a response header for the given name and value |
static void |
initialize(java.lang.Object instance) Constructor used by controllers |
java.lang.Object |
initializeCommandObject(java.lang.Object controllerInstance, java.lang.Class type, java.lang.String commandObjectParameterName) Initializes a command object. |
protected java.lang.Object |
invokeRender(java.lang.Object instance, java.lang.Object... args) |
java.lang.Object |
redirect(java.lang.Object instance, java.util.Map args) Redirects for the given arguments. |
java.lang.Object |
redirect(java.lang.Object instance, java.lang.Object object) Redirects for the given arguments. |
java.lang.Object |
render(java.lang.Object instance, java.lang.Object o) |
java.lang.Object |
render(java.lang.Object instance, java.lang.String txt) |
java.lang.Object |
render(java.lang.Object instance, java.lang.CharSequence txt) |
java.lang.Object |
render(java.lang.Object instance, java.util.Map args) |
java.lang.Object |
render(java.lang.Object instance, groovy.lang.Closure c) |
java.lang.Object |
render(java.lang.Object instance, java.util.Map args, groovy.lang.Closure c) |
java.lang.Object |
render(java.lang.Object instance, java.util.Map args, java.lang.CharSequence body) |
void |
setErrors(java.lang.Object instance, org.springframework.validation.Errors errors) Sets the errors instance of the current controller |
void |
setGspEncoding(java.lang.String gspEncoding) |
void |
setLinkGenerator(LinkGenerator linkGenerator) |
void |
setModelAndView(java.lang.Object instance, org.springframework.web.servlet.ModelAndView mav) Sets the ModelAndView of the current controller |
void |
setRedirectListeners(java.util.Collection<RedirectEventListener> redirectListeners) |
void |
setUseJessionId(boolean useJessionId) |
java.lang.Object |
withForm(java.lang.Object instance, groovy.lang.Closure callable) Used the synchronizer token pattern to avoid duplicate form submissions |
Methods inherited from class | Name |
---|---|
class CommonWebApi |
currentRequestAttributes, getActionName, getApplicationContext, getControllerClass, getControllerName, getControllerNamespace, getFlash, getGrailsApplication, getGrailsAttributes, getParams, getPluginContextPath, getRequest, getResponse, getServletContext, getSession, getWebRequest, raw, setApplicationContext, setGrailsApplication, setServletContext |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Invokes the chain method for the given arguments
instance
- The instanceargs
- The argumentsForwards a request for the given parameters using the RequestDispatchers forward method
instance
- The instanceparams
- The parametersReturns the URI of the currently executing action
Obtains the chain model which is used to chain request attributes from one request to the next via flash scope
Returns the URI of the currently executing controller
Obtains the errors instance for the current controller
Obtains the ModelAndView for the currently executing controller
Obtains a URI of a template by name
name
- The name of the templateObtains a URI of a view by name
name
- The name of the viewReturn true if there are an errors
Sets a response header for the given name and value
instance
- The instanceheaderName
- The header nameheaderValue
- The header valueConstructor used by controllers
instance
- The instanceInitializes a command object. If type is a domain class and the request body or parameters include an id, the id is used to retrieve the command object instance from the database, otherwise the no-arg constructor on type is invoke. If an attempt is made to retrieve the command object instance from the database and no corresponding record is found, null is returned. The command object is then subjected to data binding and dependency injection before being returned.
controllerInstance
- The controller instancetype
- The type of the command objectRedirects for the given arguments.
args
- The argumentsRedirects for the given arguments.
object
- A domain classSets the errors instance of the current controller
errors
- The error instanceSets the ModelAndView of the current controller
mav
- The ModelAndViewUsed the synchronizer token pattern to avoid duplicate form submissions
instance
- The instancecallable
- The closure to execute