public class ControllerArtefactHandler extends ArtefactHandlerAdapter implements GrailsApplicationAware
This class is responsible for looking up controller classes for uris.
Lookups are cached in non-development mode, and the cache size can be controlled using the grails.urlmapping.cache.maxsize config property.
| Modifier and Type | Class and Description |
|---|---|
static class |
ControllerArtefactHandler.ControllerCacheKey |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PLUGIN_NAME |
static java.lang.String |
TYPE |
log| Constructor and Description |
|---|
ControllerArtefactHandler() |
| Modifier and Type | Method and Description |
|---|---|
GrailsClass |
getArtefactForFeature(java.lang.Object featureId)
Called to retrieve an artefact relating to some other key for example a URI or tag name
|
java.lang.String |
getPluginName()
Obtains the plugin name that deals with this artefact.
|
void |
initialize(ArtefactInfo artefacts)
Sets up the relationships between the domain classes, this has to be done after
the intial creation to avoid looping.
|
protected boolean |
namespaceMatches(GrailsControllerClass c,
java.lang.String namespace) |
protected boolean |
pluginMatches(GrailsClass c,
java.lang.String pluginName,
GrailsPluginManager grailsPluginManager) |
void |
setGrailsApplication(GrailsApplication grailsApplication)
This method is called by the
ApplicationContext that
loads the Grails application. |
getType, isArtefact, isArtefactClass, isArtefactGrailsClass, newArtefactClasspublic static final java.lang.String TYPE
public static final java.lang.String PLUGIN_NAME
public void initialize(ArtefactInfo artefacts)
ArtefactHandlerAdapterinitialize in interface ArtefactHandlerinitialize in class ArtefactHandlerAdapterartefacts - The collection of artefact classes for this handlerpublic java.lang.String getPluginName()
ArtefactHandlergetPluginName in interface ArtefactHandlergetPluginName in class ArtefactHandlerAdapterpublic GrailsClass getArtefactForFeature(java.lang.Object featureId)
ArtefactHandlerCalled to retrieve an artefact relating to some other key for example a URI or tag name
Handlers are responsible for caching the appropriate information using the data passed to them in calls to initialize()
getArtefactForFeature in interface ArtefactHandlergetArtefactForFeature in class ArtefactHandlerAdapterfeatureId - Any object that acts as a keyprotected boolean namespaceMatches(GrailsControllerClass c, java.lang.String namespace)
c - the class to inspectnamespace - a controller namespaceprotected boolean pluginMatches(GrailsClass c, java.lang.String pluginName, GrailsPluginManager grailsPluginManager)
c - the class to inspectpluginName - the name of a plugingrailsPluginManager - the plugin managerpublic void setGrailsApplication(GrailsApplication grailsApplication)
GrailsApplicationAwareThis method is called by the ApplicationContext that
loads the Grails application. The GrailsApplication instance that represents
the loaded Grails application is injected.
setGrailsApplication in interface GrailsApplicationAwaregrailsApplication - the GrailsApplication object that represents this Grails application