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

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.view.AbstractCachingViewResolver
              extended by org.springframework.web.servlet.view.UrlBasedViewResolver
                  extended by org.springframework.web.servlet.view.InternalResourceViewResolver
                      extended by org.codehaus.groovy.grails.web.servlet.view.GrailsViewResolver
All Implemented Interfaces:
ApplicationContextAware, ResourceLoaderAware, Ordered, ServletContextAware, ViewResolver

public class GrailsViewResolver
extends InternalResourceViewResolver
implements ResourceLoaderAware, ApplicationContextAware

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
           
 
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 setPluginMetaManager(PluginMetaManager pluginMetaManager)
           
 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
 
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, 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
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

setPluginMetaManager

public void setPluginMetaManager(PluginMetaManager pluginMetaManager)

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


Copyright (c) 2005-2006 The Grails project