org.codehaus.groovy.grails.web.pages.discovery
Class DefaultGroovyPageLocator

java.lang.Object
  extended by org.codehaus.groovy.grails.web.pages.discovery.DefaultGroovyPageLocator
All Implemented Interfaces:
org.codehaus.groovy.grails.plugins.PluginManagerAware, GroovyPageLocator, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
Direct Known Subclasses:
GrailsConventionGroovyPageLocator

public class DefaultGroovyPageLocator
extends java.lang.Object
implements GroovyPageLocator, org.springframework.web.context.ServletContextAware, org.springframework.context.ApplicationContextAware, org.codehaus.groovy.grails.plugins.PluginManagerAware

Used to locate GSPs whether in development or WAR deployed mode from static resources, custom resource loaders and binary plugins.

Since:
2.0

Nested Class Summary
static class DefaultGroovyPageLocator.PluginViewPathInfo
           
 
Field Summary
protected  org.codehaus.groovy.grails.plugins.GrailsPluginManager pluginManager
           
protected  boolean reloadEnabled
           
protected  java.util.Collection<org.springframework.core.io.ResourceLoader> resourceLoaders
           
protected  boolean warDeployed
           
 
Constructor Summary
DefaultGroovyPageLocator()
           
 
Method Summary
 void addResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
          Adds a new resource loader to search
protected  GroovyPageCompiledScriptSource createGroovyPageCompiledScriptSource(java.lang.String uri, java.lang.String fullPath, java.lang.Class<?> viewClass)
           
protected  GroovyPageScriptSource findBinaryScriptSource(java.lang.String uri)
           
 GroovyPageScriptSource findPage(java.lang.String uri)
          Finds a page for the given URI
 GroovyPageScriptSource findPageInBinding(java.lang.String uri, GroovyPageBinding binding)
          Finds a page for the URI and binding
 GroovyPageScriptSource findPageInBinding(java.lang.String pluginName, java.lang.String uri, GroovyPageBinding binding)
          Finds a page for the given URI
protected  org.springframework.core.io.Resource findReloadablePage(java.lang.String uri)
           
protected  org.springframework.core.io.Resource findResource(java.util.List<java.lang.String> searchPaths)
           
protected  org.springframework.core.io.Resource findResource(java.lang.String uri)
           
protected  org.springframework.core.io.Resource findResourceInPlugins(java.lang.String uri)
           
protected  GroovyPageScriptSource findResourceScriptPathForSearchPaths(java.lang.String uri, java.util.List<java.lang.String> searchPaths)
           
protected  GroovyPageScriptSource findResourceScriptSource(java.lang.String uri)
           
protected  GroovyPageScriptSource findResourceScriptSourceInPlugins(java.lang.String uri)
           
static DefaultGroovyPageLocator.PluginViewPathInfo getPluginViewPathInfo(java.lang.String uri)
           
 boolean isReloadEnabled()
           
 void removePrecompiledPage(GroovyPageCompiledScriptSource scriptSource)
          Removes any precompiled pages for the given URI so that they can be replaced by dynamic pages
protected  java.lang.String removePrefix(java.lang.String uri, java.lang.String prefix)
           
protected  java.lang.String removeViewLocationPrefixes(java.lang.String uri)
           
protected  java.lang.String resolveContextPath(java.lang.String pluginName, java.lang.String uri, GroovyPageBinding binding)
           
protected  java.lang.String resolvePluginViewPath(java.lang.String uri, org.codehaus.groovy.grails.plugins.GrailsPlugin plugin)
           
protected  java.util.List<java.lang.String> resolveSearchPaths(java.lang.String uri)
           
protected  GroovyPageScriptSource resolveViewInBinaryPlugin(org.codehaus.groovy.grails.plugins.BinaryGrailsPlugin binaryPlugin, java.lang.String uri)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setPluginManager(org.codehaus.groovy.grails.plugins.GrailsPluginManager pluginManager)
           
 void setPrecompiledGspMap(java.util.Map<java.lang.String,java.lang.String> precompiledGspMap)
           
 void setReloadEnabled(boolean reloadEnabled)
           
 void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
           
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceLoaders

protected java.util.Collection<org.springframework.core.io.ResourceLoader> resourceLoaders

pluginManager

protected org.codehaus.groovy.grails.plugins.GrailsPluginManager pluginManager

warDeployed

protected boolean warDeployed

reloadEnabled

protected boolean reloadEnabled
Constructor Detail

DefaultGroovyPageLocator

public DefaultGroovyPageLocator()
Method Detail

setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)

addResourceLoader

public void addResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
Description copied from interface: GroovyPageLocator
Adds a new resource loader to search

Specified by:
addResourceLoader in interface GroovyPageLocator
Parameters:
resourceLoader - The resource loader to search

setPrecompiledGspMap

public void setPrecompiledGspMap(java.util.Map<java.lang.String,java.lang.String> precompiledGspMap)

findPage

public GroovyPageScriptSource findPage(java.lang.String uri)
Description copied from interface: GroovyPageLocator
Finds a page for the given URI

Specified by:
findPage in interface GroovyPageLocator
Parameters:
uri - The URI
Returns:
A script source

findReloadablePage

protected org.springframework.core.io.Resource findReloadablePage(java.lang.String uri)

findPageInBinding

public GroovyPageScriptSource findPageInBinding(java.lang.String pluginName,
                                                java.lang.String uri,
                                                GroovyPageBinding binding)
Description copied from interface: GroovyPageLocator
Finds a page for the given URI

Specified by:
findPageInBinding in interface GroovyPageLocator
uri - The URI
Returns:
A script source

resolveContextPath

protected java.lang.String resolveContextPath(java.lang.String pluginName,
                                              java.lang.String uri,
                                              GroovyPageBinding binding)

removePrecompiledPage

public void removePrecompiledPage(GroovyPageCompiledScriptSource scriptSource)
Description copied from interface: GroovyPageLocator
Removes any precompiled pages for the given URI so that they can be replaced by dynamic pages

Specified by:
removePrecompiledPage in interface GroovyPageLocator
Parameters:
scriptSource - The compiled script source

findPageInBinding

public GroovyPageScriptSource findPageInBinding(java.lang.String uri,
                                                GroovyPageBinding binding)
Description copied from interface: GroovyPageLocator
Finds a page for the URI and binding

Specified by:
findPageInBinding in interface GroovyPageLocator
Parameters:
uri - The URI
binding - The binding
Returns:
The page source

resolveViewInBinaryPlugin

protected GroovyPageScriptSource resolveViewInBinaryPlugin(org.codehaus.groovy.grails.plugins.BinaryGrailsPlugin binaryPlugin,
                                                           java.lang.String uri)

createGroovyPageCompiledScriptSource

protected GroovyPageCompiledScriptSource createGroovyPageCompiledScriptSource(java.lang.String uri,
                                                                              java.lang.String fullPath,
                                                                              java.lang.Class<?> viewClass)

findBinaryScriptSource

protected GroovyPageScriptSource findBinaryScriptSource(java.lang.String uri)

findResourceScriptSourceInPlugins

protected GroovyPageScriptSource findResourceScriptSourceInPlugins(java.lang.String uri)

findResourceInPlugins

protected org.springframework.core.io.Resource findResourceInPlugins(java.lang.String uri)

resolvePluginViewPath

protected java.lang.String resolvePluginViewPath(java.lang.String uri,
                                                 org.codehaus.groovy.grails.plugins.GrailsPlugin plugin)

removeViewLocationPrefixes

protected java.lang.String removeViewLocationPrefixes(java.lang.String uri)

removePrefix

protected java.lang.String removePrefix(java.lang.String uri,
                                        java.lang.String prefix)

findResourceScriptSource

protected GroovyPageScriptSource findResourceScriptSource(java.lang.String uri)

resolveSearchPaths

protected java.util.List<java.lang.String> resolveSearchPaths(java.lang.String uri)

findResourceScriptPathForSearchPaths

protected GroovyPageScriptSource findResourceScriptPathForSearchPaths(java.lang.String uri,
                                                                      java.util.List<java.lang.String> searchPaths)

findResource

protected org.springframework.core.io.Resource findResource(java.lang.String uri)

findResource

protected org.springframework.core.io.Resource findResource(java.util.List<java.lang.String> searchPaths)

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setPluginManager

public void setPluginManager(org.codehaus.groovy.grails.plugins.GrailsPluginManager pluginManager)
Specified by:
setPluginManager in interface org.codehaus.groovy.grails.plugins.PluginManagerAware

getPluginViewPathInfo

public static DefaultGroovyPageLocator.PluginViewPathInfo getPluginViewPathInfo(java.lang.String uri)

isReloadEnabled

public boolean isReloadEnabled()

setReloadEnabled

public void setReloadEnabled(boolean reloadEnabled)