Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.mapping
Interface UrlMapping

All Superinterfaces:
  Comparable, UrlCreator

All Known Implementing Classes:
  AbstractUrlMapping, RegexUrlMapping, ResponseCodeUrlMapping

    public interface UrlMapping

extends Comparable, UrlCreator

An interface that defines a URL mapping. A URL mapping is a mapping between a URI such as /book/list and a controller, action and/or id

A UrlMapping should implement Comparable so that UrlMapping instances can be ordered to allow for precendence rules. In other words the URL /book/list should be matched before /book/* as the wildcard is of lesser precedence. By implementing Comparable this can be allowed for.

Since:
  0.5

  Created: Feb 28, 2007 Time: 5:49:41 PM
Author:
  Graeme Rocher

Field Summary
`static String` | `ACTION`
`static String` | `CONTROLLER`

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()`
`UrlMappingData` | `getUrlData()` Retrieves the UrlMappingData instance that describes this UrlMapping
`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()`
`UrlMappingInfo` | `match(String uri)` Matches the given URI and returns an instance of the UrlMappingInfo interface or null if a match couldn't be established
`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 interface java.lang.Comparable
`compareTo`

Methods inherited from interface org.codehaus.groovy.grails.web.mapping.UrlCreator
`createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL`

Field Detail

### CONTROLLER

    static final String CONTROLLER

See Also:
  Constant Field Values

### ACTION

    static final String ACTION

See Also:
  Constant Field Values

Method Detail

### match

    UrlMappingInfo match(String uri)

  Matches the given URI and returns an instance of the UrlMappingInfo interface or null if a match couldn't be established

  Parameters:
    `uri` - The URI to match
  Returns:
    An instance of UrlMappingInfo or null if the URI doesn't match

### getUrlData

    UrlMappingData getUrlData()

  Retrieves the UrlMappingData instance that describes this UrlMapping

  Returns:
    The UrlMappingData instance

### getConstraints

    ConstrainedProperty[] getConstraints()

  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

  Returns:
    An array containing the ConstrainedProperty objects of this URLMapping

### getControllerName

    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

  Returns:
    The controller name as a `Closure` or `String`

### getActionName

    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

  Returns:
    The action name as a `Closure` or `String`

### getViewName

    Object getViewName()

  Returns the name of the view to map to

  Returns:
    The view name

### setParameterValues

    void setParameterValues(Map parameterValues)

  Sets any parameter values that should be populated into the request

  Parameters:
    `parameterValues` - The parameter values to set

### setParseRequest

    void setParseRequest(boolean shouldParse)

  Sets whether this UrlMapping should parse the request

  Parameters:
    `shouldParse` - True if it should

### getMappingName

    String getMappingName()

### setMappingName

    void setMappingName(String name)

### setRestfulMapping

    void setRestfulMapping(boolean isREST)

  Parameters:
    `isREST` - Set whether this is a RESTful mapping

### isRestfulMapping

    boolean isRestfulMapping()

  Returns:
    Whether this is a RESTful mapping

### hasRuntimeVariable

    boolean hasRuntimeVariable(String name)

  Whether the mapping has a runtime variable with the given name such as "/$foo"

  Parameters:
    `name` - The name of the variable
  Returns:
    True if the mapping has the variable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project