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

    java.lang.Object
      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 Object` `forwardURI`
`protected String` `mappingName`
`protected Map` `parameterValues`
`protected boolean` `parseRequest`
`protected boolean` `restful`
`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
`protected` `AbstractUrlMapping(URI uri, ConstrainedProperty[] constraints, ServletContext servletContext)`

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
`String` `getMappingName()`
`Object` `getViewName()` Returns the name of the view to map to
`boolean` `hasRuntimeVariable(String name)` Whether the mapping has a runtime variable with the given name such as "/$foo"
`boolean` `isRestfulMapping()`
`void` `setMappingName(String name)`
`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
`void` `setRestfulMapping(boolean isREST)`

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

### forwardURI

    protected Object forwardURI

### servletContext

    protected ServletContext servletContext

### parameterValues

    protected Map parameterValues

### parseRequest

    protected boolean parseRequest

### mappingName

    protected String mappingName

### restful

    protected boolean restful

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)

### AbstractUrlMapping

    protected AbstractUrlMapping(URI uri,
                                 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

### getMappingName

    public String getMappingName()

  Specified by:
    `getMappingName` in interface `UrlMapping`

### setMappingName

    public void setMappingName(String name)

  Specified by:
    `setMappingName` in interface `UrlMapping`

### setRestfulMapping

    public void setRestfulMapping(boolean isREST)

  Specified by:
    `setRestfulMapping` in interface `UrlMapping`
  Parameters:
    `isREST` - Set whether this is a RESTful mapping

### isRestfulMapping

    public boolean isRestfulMapping()

  Specified by:
    `isRestfulMapping` in interface `UrlMapping`
  Returns:
    Whether this is a RESTful mapping

### hasRuntimeVariable

    public boolean hasRuntimeVariable(String name)

  Description copied from interface: `UrlMapping`
  Whether the mapping has a runtime variable with the given name such as "/$foo"

  Specified by:
    `hasRuntimeVariable` in interface `UrlMapping`
  Parameters:
    `name` - The name of the variable
  Returns:
    True if the mapping has the variable

Copyright (c) 2005-2009 The Grails project