org.codehaus.groovy.grails.commons
Interface GrailsControllerClass

All Superinterfaces:
GrailsClass, InjectableGrailsClass
All Known Implementing Classes:
DefaultGrailsControllerClass

public interface GrailsControllerClass
extends InjectableGrailsClass

Represents a controller class in Grails.

Since:
Jul 2, 2005
Author:
Steven Devijver

Field Summary
static String ACTION
          The general name to use when referring to action artefacts
static String AFTER_INTERCEPTOR
          The name of the after interceptor property
static String BEFORE_INTERCEPTOR
          The name of the before interceptor property
static String CONTROLLER
          The general name to use when referring to controller artefacts
static String INDEX_ACTION
          The name of the index action
static 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
 String getClosurePropertyName(String uri)
          Returns a closure property name for a specific URI or null if the URI does not map to a closure.
 Set getCommandObjectActions()
           
 Set getCommandObjectClasses()
           
 String getDefaultAction()
          Returns the default action for this Controller
 Map getFlows()
          Returns a map of the flows for this controller.
 String[] getURIs()
          Gets the list of all possible URI's available in this controller.
 String getViewByName(String closureName)
          Retrieves the view name for the specified closure name
 String getViewByURI(String uri)
          Retrieves the view name for the specified URI
 boolean isFlowAction(String actionName)
          Returns true if the given action name is a flow action
 boolean isHttpMethodAllowedForAction(groovy.lang.GroovyObject controller, String httpMethod, String actionName)
          Checks to see if an action is accessible via a particular http method
 boolean isInterceptedAfter(groovy.lang.GroovyObject controller, String action)
          Checks whether the specified action is intercepted after for the specified controller instance
 boolean isInterceptedBefore(groovy.lang.GroovyObject controller, String action)
          Checks whether the specified action is intercepted for the specified controller instance
 boolean mapsToURI(String uri)
          Tests if a controller maps to a given URI.
 void registerMapping(String actionName)
          Registers a new mapping onto this controller for the given actionName
 void setDefaultActionName(String defaultActionName)
          Sets the name of the default action
 
Methods inherited from interface org.codehaus.groovy.grails.commons.InjectableGrailsClass
byName, byType, getAvailable
 
Methods inherited from interface org.codehaus.groovy.grails.commons.GrailsClass
getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPropertyName, getPropertyValue, getPropertyValue, getReference, getShortName, hasProperty, newInstance
 

Field Detail

INDEX_ACTION

static final String INDEX_ACTION
The name of the index action

See Also:
Constant Field Values

BEFORE_INTERCEPTOR

static final String BEFORE_INTERCEPTOR
The name of the before interceptor property

See Also:
Constant Field Values

AFTER_INTERCEPTOR

static final String AFTER_INTERCEPTOR
The name of the after interceptor property

See Also:
Constant Field Values

CONTROLLER

static final String CONTROLLER
The general name to use when referring to controller artefacts

See Also:
Constant Field Values

ACTION

static final String ACTION
The general name to use when referring to action artefacts

See Also:
Constant Field Values

VIEW

static final String VIEW
The general name to use when referring to action view

See Also:
Constant Field Values
Method Detail

isHttpMethodAllowedForAction

boolean isHttpMethodAllowedForAction(groovy.lang.GroovyObject controller,
                                     String httpMethod,
                                     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

isInterceptedBefore

boolean isInterceptedBefore(groovy.lang.GroovyObject controller,
                            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

isInterceptedAfter

boolean isInterceptedAfter(groovy.lang.GroovyObject controller,
                           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

getBeforeInterceptor

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

getAfterInterceptor

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

getURIs

String[] getURIs()

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

Returns:
list of all possible URI's

mapsToURI

boolean mapsToURI(String uri)

Tests if a controller maps to a given URI.

Returns:
true if controller maps to URI

getViewByURI

String getViewByURI(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

getViewByName

String getViewByName(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

getClosurePropertyName

String getClosurePropertyName(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

getCommandObjectActions

Set getCommandObjectActions()
Returns:
A Set of names of actions with command objects presented in this controller

getCommandObjectClasses

Set getCommandObjectClasses()
Returns:
A Set of command object classes used by this controller

getFlows

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 (@see groovy.lang.Closure) which represent the flow definition

Returns:
A Map of flows for this controller

isFlowAction

boolean isFlowAction(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

getDefaultAction

String getDefaultAction()
Returns the default action for this Controller

Returns:
The default action

registerMapping

void registerMapping(String actionName)
Registers a new mapping onto this controller for the given actionName

Parameters:
actionName - The actionName

setDefaultActionName

void setDefaultActionName(String defaultActionName)
Sets the name of the default action

Parameters:
defaultActionName - The default action name


Copyright (c) 2005-2009 The Grails project