## org.codehaus.groovy.grails.web.servlet.view
Class GrailsViewResolver

    java.lang.Object
      org.springframework.context.support.ApplicationObjectSupport
          org.springframework.web.context.support.WebApplicationObjectSupport
              org.springframework.web.servlet.view.AbstractCachingViewResolver
                  org.springframework.web.servlet.view.UrlBasedViewResolver
                      org.springframework.web.servlet.view.InternalResourceViewResolver
                          org.codehaus.groovy.grails.web.servlet.view.GrailsViewResolver

All Implemented Interfaces:
  PluginManagerAware, ApplicationContextAware, ResourceLoaderAware, Ordered, ServletContextAware, ViewResolver

Direct Known Subclasses:
  ScaffoldingViewResolver

    public class GrailsViewResolver

extends InternalResourceViewResolver
implements ResourceLoaderAware, ApplicationContextAware, PluginManagerAware

A Grails view resolver which evaluates the existance of a view for different extensions choosing which one to delegate to.

Since:
  0.1 Created: 11-Jan-2006
Author:
  Graeme Rocher

Field Summary
`static String` `GSP_SUFFIX`
`static String` `JSP_SUFFIX`
`protected GroovyPagesTemplateEngine` `templateEngine`

Fields inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver
`FORWARD_URL_PREFIX, REDIRECT_URL_PREFIX`

Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
`logger`

Fields inherited from interface org.springframework.core.Ordered
`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

Constructor Summary
`GrailsViewResolver()`

Method Summary
`protected View` `loadView(String viewName, Locale locale)`
`protected String` `resolveViewForController(groovy.lang.GroovyObject controller, GrailsApplication application, String viewName, ResourceLoader resourceLoader)` Attempst to resolve a view relative to a controller
`void` `setPluginManager(GrailsPluginManager pluginManager)` Sets the plug-in manager on this instance
`void` `setPrefix(String prefix)`
`void` `setResourceLoader(ResourceLoader resourceLoader)`
`void` `setSuffix(String suffix)`
`void` `setTemplateEngine(GroovyPagesTemplateEngine templateEngine)`

Methods inherited from class org.springframework.web.servlet.view.InternalResourceViewResolver
`buildView, requiredViewClass, setAlwaysInclude, setExposeContextBeansAsAttributes, setExposedContextBeanNames`

Methods inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver

`canHandle, createView, getAttributesMap, getCacheKey, getContentType, getOrder, getPrefix, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, isRedirectContextRelative, isRedirectHttp10Compatible, setAttributes, setAttributesMap, setContentType, setOrder, setRedirectContextRelative, setRedirectHttp10Compatible, setRequestContextAttribute, setViewClass, setViewNames`

Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver
`clearCache, isCache, removeFromCache, resolveViewName, setCache`

Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext`

Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
`getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.springframework.context.ApplicationContextAware
`setApplicationContext`

Field Detail

### GSP_SUFFIX

    public static final String GSP_SUFFIX

See Also:
  Constant Field Values

### JSP_SUFFIX

    public static final String JSP_SUFFIX

See Also:
  Constant Field Values

### templateEngine

    protected GroovyPagesTemplateEngine templateEngine

Constructor Detail

### GrailsViewResolver

    public GrailsViewResolver()

Method Detail

### setPrefix

    public void setPrefix(String prefix)

  Overrides:
    `setPrefix` in class `UrlBasedViewResolver`

### setSuffix

    public void setSuffix(String suffix)

  Overrides:
    `setSuffix` in class `UrlBasedViewResolver`

### setResourceLoader

    public void setResourceLoader(ResourceLoader resourceLoader)

  Specified by:
    `setResourceLoader` in interface `ResourceLoaderAware`

### setTemplateEngine

    public void setTemplateEngine(GroovyPagesTemplateEngine templateEngine)

### loadView

    protected View loadView(String viewName,
                            Locale locale)
                     throws Exception

  Overrides:
    `loadView` in class `UrlBasedViewResolver`
  Throws:
    `Exception`

### resolveViewForController

    protected String resolveViewForController(groovy.lang.GroovyObject controller,
                                              GrailsApplication application,
                                              String viewName,
                                              ResourceLoader resourceLoader)

  Attempst to resolve a view relative to a controller

  Parameters:
    `controller` - The controller to resolve the view relative to
    `application` - The GrailsApplication instance
    `viewName` - The views name
    `resourceLoader` - The ResourceLoader to use
  Returns:
    The URI of the view

### setPluginManager

    public void setPluginManager(GrailsPluginManager pluginManager)

  Description copied from interface: `PluginManagerAware`
  Sets the plug-in manager on this instance

  Specified by:
    `setPluginManager` in interface `PluginManagerAware`
  Parameters:
    `pluginManager` - The PluginManager

Copyright (c) 2005-2009 The Grails project