Package: org.codehaus.groovy.grails.web.pages.discovery

## [Java] Class GrailsConventionGroovyPageLocator

- org.codehaus.groovy.grails.web.pages.discovery.GrailsConventionGroovyPageLocator

- All Implemented Interfaces and Traits:
    GrailsApplicationAware

      public class GrailsConventionGroovyPageLocator
      extends DefaultGroovyPageLocator

  Extended GroovyPageLocator that deals with the details of Grails' conventions for controllers names, view names and template names

  Authors:
    Graeme Rocher
  Since:
    2.0

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class DefaultGroovyPageLocator` | `pluginManager, reloadEnabled, resourceLoaders, warDeployed`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `GroovyPageScriptSource` | `findTemplate(java.lang.String controllerName, java.lang.String templateName)` Finds a template for the given controller name and template name
    `GroovyPageScriptSource` | `findTemplate(java.lang.Object controller, java.lang.String templateName)` Finds a template for the given controller name and template name
    `GroovyPageScriptSource` | `findTemplate(java.lang.String templateName)` Finds a template for the given given template name, looking up the controller from the request as necessary
    `GroovyPageScriptSource` | `findTemplateByPath(java.lang.String uri)` Find a template for a path.
    `GroovyPageScriptSource` | `findTemplateInBinding(java.lang.String templateName, GroovyPageBinding binding)` Finds a template for the given given template name, looking up the controller from the request as necessary
    `GroovyPageScriptSource` | `findTemplateInBinding(java.lang.String pluginName, java.lang.String templateName, GroovyPageBinding binding)` Finds a template for the given given template name, looking up the controller from the request as necessary
    `GroovyPageScriptSource` | `findView(java.lang.String controllerName, java.lang.String viewName)`
    `GroovyPageScriptSource` | `findView(java.lang.String controllerName, java.lang.String viewName, java.lang.String format)`
    `GroovyPageScriptSource` | `findView(java.lang.Object controller, java.lang.String viewName)`
    `GroovyPageScriptSource` | `findView(java.lang.String viewName)` Finds a view for the given given view name, looking up the controller from the request as necessary
    `GroovyPageScriptSource` | `findViewByPath(java.lang.String uri)` Find a view for a path.
    `GroovyPageScriptSource` | `findViewForFormat(java.lang.String controllerName, java.lang.String viewName, java.lang.String format)` Finds a view for the given view name and format, otherwise returns null if it doesn't exist
    `protected java.lang.String` | `getNameForController(java.lang.Object controller)`
    `protected java.lang.String` | `lookupRequestFormat()`
    `java.lang.String` | `resolveViewFormat(java.lang.String viewName)`
    `void` | `setGrailsApplication(GrailsApplication grailsApplication)`
    `void` | `setMimeTypeResolver(MimeTypeResolver mimeTypeResolver)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class DefaultGroovyPageLocator` | `addResourceLoader, createGroovyPageCompiledScriptSource, findBinaryScriptSource, findPage, findPageInBinding, findPageInBinding, findReloadablePage, findResource, findResource, findResourceInPlugins, findResourceScriptPathForSearchPaths, findResourceScriptSource, findResourceScriptSourceInPlugins, getPluginViewPathInfo, isReloadEnabled, removePrecompiledPage, removePrefix, removeViewLocationPrefixes, resolveContextPath, resolvePluginViewPath, resolveSearchPaths, resolveViewInBinaryPlugin, setApplicationContext, setPluginManager, setPrecompiledGspMap, setReloadEnabled, setResourceLoader, 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()`

- - ### Method Detail

    - #### public GroovyPageScriptSource findTemplate(java.lang.String controllerName, java.lang.String templateName)

      Finds a template for the given controller name and template name

      Parameters:
        `controllerName` - The controller name
        `templateName` - The view name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findTemplate(java.lang.Object controller, java.lang.String templateName)

      Finds a template for the given controller name and template name

      Parameters:
        `controller` - The controller n
        `templateName` - The view name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findTemplate(java.lang.String templateName)

      Finds a template for the given given template name, looking up the controller from the request as necessary

      Parameters:
        `templateName` - The template name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findTemplateByPath(java.lang.String uri)

      Find a template for a path. For example /foo/bar will search for /WEB-INF/grails-app/views/foo/_bar.gsp in production and grails-app/views/foo/_bar.gsp at development time

      Parameters:
        `uri` - The uri to search
      Returns:
        The script source

    - #### public GroovyPageScriptSource findTemplateInBinding(java.lang.String templateName, GroovyPageBinding binding)

      Finds a template for the given given template name, looking up the controller from the request as necessary

      Parameters:
        `templateName` - The template name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findTemplateInBinding(java.lang.String pluginName, java.lang.String templateName, GroovyPageBinding binding)

      Finds a template for the given given template name, looking up the controller from the request as necessary

      Parameters:
        `pluginName` - The plugin
        `templateName` - The template name
        `binding` - The binding
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findView(java.lang.String controllerName, java.lang.String viewName)

      Finds a view for the given controller name and view name. For example specifying a controller name of "home" and a view name of "index" will search for /WEB-INF/grails-app/views/home/index.gsp in production and grails-app/views/home/index.gsp in development

      This method will also detect the presence of the requested response format and try to resolve a more appropriate view. For example in the response format is 'xml' then /WEB-INF/grails-app/views/home/index.xml.gsp will be tried first

      If the view is not found in the application then a scan is executed that searches through binary and source plugins looking for the first matching view name

      Parameters:
        `controllerName` - The controller name
        `viewName` - The view name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findView(java.lang.String controllerName, java.lang.String viewName, java.lang.String format)

    - #### public GroovyPageScriptSource findView(java.lang.Object controller, java.lang.String viewName)

      Finds a view for the given controller and view name. For example specifying a controller with a class name of HomeController and a view name of "index" will search for /WEB-INF/grails-app/views/home/index.gsp in production and grails-app/views/home/index.gsp in development

      If the view is not found in the application then a scan is executed that searches through binary and source plugins looking for the first matching view name

      Parameters:
        `controller` - The controller
        `viewName` - The view name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findView(java.lang.String viewName)

      Finds a view for the given given view name, looking up the controller from the request as necessary

      Parameters:
        `viewName` - The view name
      Returns:
        The GroovyPageScriptSource

    - #### public GroovyPageScriptSource findViewByPath(java.lang.String uri)

      Find a view for a path. For example /foo/bar will search for /WEB-INF/grails-app/views/foo/bar.gsp in production and grails-app/views/foo/bar.gsp at development time

      Parameters:
        `uri` - The uri to search
      Returns:
        The script source

    - #### public GroovyPageScriptSource findViewForFormat(java.lang.String controllerName, java.lang.String viewName, java.lang.String format)

      Finds a view for the given view name and format, otherwise returns null if it doesn't exist

      Parameters:
        `controllerName` - The controller name
        `viewName` - The view name
        `format` - The format
      Returns:
        The script source or null

    - #### protected java.lang.String getNameForController(java.lang.Object controller)

    - #### protected java.lang.String lookupRequestFormat()

    - #### public java.lang.String resolveViewFormat(java.lang.String viewName)

    - #### @java.lang.Overridede public public void setGrailsApplication(GrailsApplication grailsApplication)

    - #### @org.springframework.beans.factory.annotation.Autowired(required = false) public void setMimeTypeResolver(MimeTypeResolver mimeTypeResolver)