org.codehaus.groovy.grails.web.mapping
Class DefaultUrlMappingEvaluator

java.lang.Object
  extended by org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator
All Implemented Interfaces:
ClassLoaderAware, UrlMappingEvaluator

public class DefaultUrlMappingEvaluator
extends Object
implements UrlMappingEvaluator, ClassLoaderAware

A UrlMapping evaluator that evaluates Groovy scripts that are in the form:

 
 mappings {
    /$post/$year?/$month?/$day?" {
       controller = "blog"
       action = "show"
       constraints {
           year(matches:/\d{4}/)
           month(matches:/\d{2}/)
       }
    }
 }
 
 

Since:
0.5

Created: Mar 5, 2007 Time: 5:45:32 PM

Author:
Graeme Rocher

Nested Class Summary
(package private)  class DefaultUrlMappingEvaluator.MappingCapturingClosure
          A Closure that captures a call to a method that accepts a single closure
(package private)  class DefaultUrlMappingEvaluator.UrlMappingBuilder
          A modal builder that constructs a UrlMapping instances by executing a closure.
 
Constructor Summary
DefaultUrlMappingEvaluator()
           
 
Method Summary
 List evaluateMappings(Class theClass)
          Evaluates mapping from the given class if possible
 List evaluateMappings(groovy.lang.Closure closure)
          Evaluates mapping from the given closure if possible
 List evaluateMappings(Resource resource)
          Evaluates URL mapping from the give Spring Resource
 void setClassLoader(ClassLoader classLoader)
          This method is called by the ApplicationContext that loads the Grails application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUrlMappingEvaluator

public DefaultUrlMappingEvaluator()
Method Detail

evaluateMappings

public List evaluateMappings(Resource resource)
Description copied from interface: UrlMappingEvaluator
Evaluates URL mapping from the give Spring Resource

Specified by:
evaluateMappings in interface UrlMappingEvaluator
Parameters:
resource - The Spring Resource to evaluate mapping from
Returns:
A list of UrlMapping instances

evaluateMappings

public List evaluateMappings(Class theClass)
Description copied from interface: UrlMappingEvaluator
Evaluates mapping from the given class if possible

Specified by:
evaluateMappings in interface UrlMappingEvaluator
Parameters:
theClass - The class to evaluate mapping from
Returns:
A list of UrlMapping instances

evaluateMappings

public List evaluateMappings(groovy.lang.Closure closure)
Description copied from interface: UrlMappingEvaluator
Evaluates mapping from the given closure if possible

Specified by:
evaluateMappings in interface UrlMappingEvaluator
Parameters:
closure - The closure to evaluate mapping from
Returns:
A list of UrlMapping instances

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Description copied from interface: ClassLoaderAware

This method is called by the ApplicationContext that loads the Grails application. The ClassLoader that loads the Grails application code is injected.

Specified by:
setClassLoader in interface ClassLoaderAware
Parameters:
classLoader - the ClassLoader that loads the Grails application code


Copyright (c) 2005-2006 The Grails project