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

java.lang.Object
  extended by org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
All Implemented Interfaces:
Comparable, UrlCreator, UrlMapping
Direct Known Subclasses:
RegexUrlMapping, ResponseCodeUrlMapping

public abstract class AbstractUrlMapping
extends Object
implements UrlMapping

Abstract UrlMapping implementation that provides common basic functionality

Since:
0.5.5

Created: May 30, 2007 Time: 8:25:36 AM

Author:
Graeme Rocher

Field Summary
protected  Object actionName
           
protected  ConstrainedProperty[] constraints
           
protected  Object controllerName
           
protected  Map parameterValues
           
protected  boolean parseRequest
           
protected  ServletContext servletContext
           
protected  Object viewName
           
 
Fields inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping
ACTION, CONTROLLER
 
Constructor Summary
protected AbstractUrlMapping(Object viewName, ConstrainedProperty[] constraints, ServletContext servletContext)
           
  AbstractUrlMapping(Object controllerName, Object actionName, Object viewName, ConstrainedProperty[] constraints, ServletContext servletContext)
          Base constructor required to construct a UrlMapping instance
 
Method Summary
 Object getActionName()
          Retrieves the action name which is either a groovy.lang.Closure that evaluates the action name at runtime or a java.lang.String that represents the action name
 ConstrainedProperty[] getConstraints()
          The constraints the apply to this UrlMapping.
 Object getControllerName()
          Retrieves the controller name which is either a groovy.lang.Closure that evaluates the controller name at runtime or a java.lang.String that represents the controller name
 Object getViewName()
          Returns the name of the view to map to
 void setParameterValues(Map parameterValues)
          Sets any parameter values that should be populated into the request
 void setParseRequest(boolean shouldParse)
          Sets whether this UrlMapping should parse the request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping
getUrlData, match
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.codehaus.groovy.grails.web.mapping.UrlCreator
createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL
 

Field Detail

constraints

protected final ConstrainedProperty[] constraints

controllerName

protected Object controllerName

actionName

protected Object actionName

viewName

protected Object viewName

servletContext

protected ServletContext servletContext

parameterValues

protected Map parameterValues

parseRequest

protected boolean parseRequest
Constructor Detail

AbstractUrlMapping

public AbstractUrlMapping(Object controllerName,
                          Object actionName,
                          Object viewName,
                          ConstrainedProperty[] constraints,
                          ServletContext servletContext)
Base constructor required to construct a UrlMapping instance

Parameters:
controllerName - The name of the controller
actionName - The name of the action
constraints - Any constraints that apply to the mapping
servletContext -

AbstractUrlMapping

protected AbstractUrlMapping(Object viewName,
                             ConstrainedProperty[] constraints,
                             ServletContext servletContext)
Method Detail

getConstraints

public ConstrainedProperty[] getConstraints()
Description copied from interface: UrlMapping

The constraints the apply to this UrlMapping. Each constraint maps to a GString token in a URL mapping in order. For example consider the URL:

 
     /blog/$author/$title/$year?/$month?/$day?
 

This results in 5 ConstrainedProperty instances called author, title, year, month and day

Specified by:
getConstraints in interface UrlMapping
Returns:
An array containing the ConstrainedProperty objects of this URLMapping
See Also:
UrlMapping.getConstraints()

getControllerName

public Object getControllerName()
Description copied from interface: UrlMapping
Retrieves the controller name which is either a groovy.lang.Closure that evaluates the controller name at runtime or a java.lang.String that represents the controller name

Specified by:
getControllerName in interface UrlMapping
Returns:
The controller name as a Closure or String
See Also:
UrlMapping.getControllerName()

getActionName

public Object getActionName()
Description copied from interface: UrlMapping
Retrieves the action name which is either a groovy.lang.Closure that evaluates the action name at runtime or a java.lang.String that represents the action name

Specified by:
getActionName in interface UrlMapping
Returns:
The action name as a Closure or String
See Also:
UrlMapping.getActionName()

getViewName

public Object getViewName()
Description copied from interface: UrlMapping
Returns the name of the view to map to

Specified by:
getViewName in interface UrlMapping
Returns:
The view name
See Also:
UrlMapping.getViewName()

setParameterValues

public void setParameterValues(Map parameterValues)
Description copied from interface: UrlMapping
Sets any parameter values that should be populated into the request

Specified by:
setParameterValues in interface UrlMapping
Parameters:
parameterValues - The parameter values to set

setParseRequest

public void setParseRequest(boolean shouldParse)
Description copied from interface: UrlMapping
Sets whether this UrlMapping should parse the request

Specified by:
setParseRequest in interface UrlMapping
Parameters:
shouldParse - True if it should


Copyright (c) 2005-2009 The Grails project