Groovy Documentation

org.codehaus.groovy.grails.commons
[Java] Interface GrailsControllerClass

org.codehaus.groovy.grails.commons.InjectableGrailsClass
  org.codehaus.groovy.grails.commons.GrailsClass
      org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware
          org.codehaus.groovy.grails.commons.GrailsControllerClass
All Superinterfaces:
InjectableGrailsClass, GrailsClass, GrailsApplicationAware

public interface GrailsControllerClass
extends InjectableGrailsClass

Represents a controller class in Grails.

Authors:
Steven Devijver


Field Summary
java.lang.String ACTION

The general name to use when referring to action artefacts.

java.lang.String AFTER_INTERCEPTOR

The name of the after interceptor property.

java.lang.String BEFORE_INTERCEPTOR

The name of the before interceptor property.

java.lang.String CONTROLLER

The general name to use when referring to controller artefacts.

java.lang.String INDEX_ACTION

The name of the index action.

java.lang.String VIEW

The general name to use when referring to action view.

 
Method Summary
groovy.lang.Closure getAfterInterceptor(groovy.lang.GroovyObject controller)

Retrieves the after interceptor for the specified controller instance.

groovy.lang.Closure getBeforeInterceptor(groovy.lang.GroovyObject controller)

Retrieves the before interceptor for the specified controller instance.

java.util.Set getCommandObjectActions()

@deprecated This method is deprecated and will be removed in a future version of Grails

java.util.Set getCommandObjectClasses()

@deprecated This method is deprecated and will be removed in a future version of Grails

java.lang.String getDefaultAction()

Returns the default action for this Controller.

java.util.Map getFlows()

java.lang.String getMethodActionName(java.lang.String uri)

Returns a closure property name for a specific URI or null if the URI does not map to a closure.

java.lang.String[] getURIs()

Gets the list of all possible URI's available in this controller.

java.lang.String getViewByName(java.lang.String closureName)

Retrieves the view name for the specified closure name.

java.lang.String getViewByURI(java.lang.String uri)

Retrieves the view name for the specified URI.

void initialize()

Initialize the controller class

boolean isFlowAction(java.lang.String actionName)

Returns true if the given action name is a flow action.

boolean isHttpMethodAllowedForAction(groovy.lang.GroovyObject controller, java.lang.String httpMethod, java.lang.String actionName)

Checks to see if an action is accessible via a particular http method.

boolean isInterceptedAfter(groovy.lang.GroovyObject controller, java.lang.String action)

Checks whether the specified action is intercepted after for the specified controller instance.

boolean isInterceptedBefore(groovy.lang.GroovyObject controller, java.lang.String action)

Checks whether the specified action is intercepted for the specified controller instance.

boolean mapsToURI(java.lang.String uri)

Tests if a controller maps to a given URI.

void registerMapping(java.lang.String actionName)

Registers a new mapping onto this controller for the given actionName.

void setDefaultActionName(java.lang.String defaultActionName)

Sets the name of the default action.

 
Methods inherited from interface InjectableGrailsClass
byName, byType, getAvailable
 
Methods inherited from interface GrailsClass
getClazz, getFullName, getGrailsApplication, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPropertyName, getPropertyValue, getPropertyValue, getReference, getReferenceInstance, getShortName, hasProperty, isAbstract, newInstance
 
Methods inherited from interface GrailsApplicationAware
setGrailsApplication
 

Field Detail

ACTION

public java.lang.String ACTION
The general name to use when referring to action artefacts.


AFTER_INTERCEPTOR

public java.lang.String AFTER_INTERCEPTOR
The name of the after interceptor property.


BEFORE_INTERCEPTOR

public java.lang.String BEFORE_INTERCEPTOR
The name of the before interceptor property.


CONTROLLER

public java.lang.String CONTROLLER
The general name to use when referring to controller artefacts.


INDEX_ACTION

public java.lang.String INDEX_ACTION
The name of the index action.


VIEW

public java.lang.String VIEW
The general name to use when referring to action view.


 
Method Detail

getAfterInterceptor

@SuppressWarnings("rawtypes")
public groovy.lang.Closure getAfterInterceptor(groovy.lang.GroovyObject controller)
Retrieves the after interceptor for the specified controller instance.
Parameters:
controller - The controller instance
Returns:
The after interceptor as a Closure or null if non exists


getBeforeInterceptor

@SuppressWarnings("rawtypes")
public groovy.lang.Closure getBeforeInterceptor(groovy.lang.GroovyObject controller)
Retrieves the before interceptor for the specified controller instance.
Parameters:
controller - The controller instance
Returns:
The before interceptor as a Closure or null if non exists


getCommandObjectActions

@Deprecated
@SuppressWarnings("rawtypes")
public java.util.Set getCommandObjectActions()
deprecated:
This method is deprecated and will be removed in a future version of Grails
Returns:
A Set of names of actions with command objects presented in this controller


getCommandObjectClasses

@Deprecated
@SuppressWarnings("rawtypes")
public java.util.Set getCommandObjectClasses()
deprecated:
This method is deprecated and will be removed in a future version of Grails
Returns:
command object classes used by this controller


getDefaultAction

public java.lang.String getDefaultAction()
Returns the default action for this Controller.
Returns:
The default action


getFlows

@SuppressWarnings("rawtypes")
public java.util.Map getFlows()

Returns a map of the flows for this controller. A flow is an action that ends with the convention "Flow". The keys in the map are the flow ids which are the text before the "Flow" suffix. For example a flow called "bookFlow" would have a key of "book"

The values within the Map are Groovy closures (

Returns:
A Map of flows for this controller
See Also:
groovy.lang.Closure


getMethodActionName

public java.lang.String getMethodActionName(java.lang.String uri)
Returns a closure property name for a specific URI or null if the URI does not map to a closure.
Parameters:
uri - the URI of the request
Returns:
the closure property name mapped to the URI or null is no closure was found


getURIs

public java.lang.String[] getURIs()
Gets the list of all possible URI's available in this controller.
Returns:
list of all possible URI's


getViewByName

public java.lang.String getViewByName(java.lang.String closureName)
Retrieves the view name for the specified closure name.
Parameters:
closureName - The name of the closure
Returns:
The view for the specified closure action


getViewByURI

public java.lang.String getViewByURI(java.lang.String uri)
Retrieves the view name for the specified URI.
Parameters:
uri - the name of URI
Returns:
the view name of null if not found


initialize

public void initialize()
Initialize the controller class


isFlowAction

public boolean isFlowAction(java.lang.String actionName)
Returns true if the given action name is a flow action.
Parameters:
actionName - The name of the action
Returns:
True if it is a flow action


isHttpMethodAllowedForAction

public boolean isHttpMethodAllowedForAction(groovy.lang.GroovyObject controller, java.lang.String httpMethod, java.lang.String actionName)
Checks to see if an action is accessible via a particular http method.
Parameters:
controller - The instance of the controller
httpMethod - The http request method
actionName - The action to check
Returns:
true if the action is accessible via the specified http method


isInterceptedAfter

public boolean isInterceptedAfter(groovy.lang.GroovyObject controller, java.lang.String action)
Checks whether the specified action is intercepted after for the specified controller instance.
Parameters:
controller - The controller instance
action - The action to check
Returns:
True if it is intercepted


isInterceptedBefore

public boolean isInterceptedBefore(groovy.lang.GroovyObject controller, java.lang.String action)
Checks whether the specified action is intercepted for the specified controller instance.
Parameters:
controller - The instance of the controller
action - The action to check
Returns:
True if it is intercepted


mapsToURI

public boolean mapsToURI(java.lang.String uri)
Tests if a controller maps to a given URI.
Returns:
true if controller maps to URI


registerMapping

public void registerMapping(java.lang.String actionName)
Registers a new mapping onto this controller for the given actionName.
Parameters:
actionName - The actionName


setDefaultActionName

public void setDefaultActionName(java.lang.String defaultActionName)
Sets the name of the default action.
Parameters:
defaultActionName - The default action name


 

Groovy Documentation