Package: grails.web.mapping

## [Java] Interface UrlMapping

- grails.web.mapping.UrlCreator

- All Superinterfaces:
    UrlCreator

      @java.lang.SuppressWarnings("rawtypes")
      public interface UrlMapping
      extends java.lang.Comparable, UrlCreator

  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.

  Authors:
    Graeme Rocher
  Since:
    0.5

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `java.lang.String` | `ACTION` | The action this mapping matches
    `char` | `AMPERSAND` |
    `java.lang.String` | `ANY_HTTP_METHOD` | Constant used to define a Url mapping that matches any HTTP method
    `java.lang.String` | `ANY_VERSION` | Constant used to define a Url mapping that matches any HTTP method
    `java.lang.String` | `CAPTURED_DOUBLE_WILDCARD` |
    `java.lang.String` | `CAPTURED_WILDCARD` |
    `java.lang.String` | `CONTROLLER` | The controller this mapping matches
    `java.lang.String` | `DOUBLE_WILDCARD` |
    `java.lang.String` | `EXCEPTION` |
    `java.lang.String` | `EXCLUDES` |
    `java.lang.String` | `HTTP_METHOD` | The HTTP method this mapping matches
    `java.lang.String` | `INCLUDES` |
    `java.util.Set<java.lang.String>` | `KEYWORDS` |
    `java.lang.String` | `NAMESPACE` | The namespace of the URL mapping
    `java.lang.String` | `OPTIONAL_EXTENSION_WILDCARD` |
    `java.lang.String` | `PERMANENT` |
    `java.lang.String` | `PLUGIN` | The plugin of the URL Mapping
    `char` | `QUESTION_MARK` |
    `java.lang.String` | `REDIRECT_INFO` | Redirect information for this url mapping.
    `java.lang.String` | `RESOURCES` |
    `java.lang.String` | `SLASH` |
    `java.lang.String` | `URI` | The URI of the URL mapping
    `java.lang.String` | `VERSION` | The version of the URL mapping
    `java.lang.String` | `VIEW` |
    `java.lang.String` | `WILDCARD` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public java.lang.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
    `` | `public Constrained[]` | `getConstraints()`
    `` | `public java.lang.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
    `` | `public java.lang.String` | `getHttpMethod()` The HTTP method this URL mapping applies to.
    `` | `public java.lang.String` | `getMappingName()` The name of the mapping in case of named URL mapping
    `` | `public java.lang.Object` | `getNamespace()` Returns: the name of the controller namespace
    `` | `public java.lang.Integer` | `getPluginIndex()` Returns: The plugin index or null
    `` | `public java.lang.Object` | `getPluginName()` The name of the plugin this URL mapping relates to, if any
    `` | `public java.lang.Object` | `getRedirectInfo()` The redirect information should be a String or a Map.
    `` | `public UrlMappingData` | `getUrlData()` Retrieves the UrlMappingData instance that describes this UrlMapping
    `` | `public java.lang.String` | `getVersion()` Returns: The version of the URL mapping.
    `` | `public java.lang.Object` | `getViewName()` Returns the name of the view to map to
    `` | `public boolean` | `hasRuntimeVariable(java.lang.String name)` Whether the mapping has a runtime variable with the given name such as "/$foo"
    `` | `public boolean` | `isDefinedInPlugin()` Returns: True if the URL mapping comes from a plugin
    `` | `public UrlMappingInfo` | `match(java.lang.String uri)` Matches the given URI and returns an instance of the UrlMappingInfo interface or null if a match couldn't be established
    `` | `public void` | `setMappingName(java.lang.String name)` Sets the name of the URL mapping
    `` | `public void` | `setParameterValues(java.util.Map parameterValues)` Sets any parameter values that should be populated into the request
    `` | `public void` | `setParseRequest(boolean shouldParse)` Sets whether this UrlMapping should parse the request
    `` | `public void` | `setPluginIndex(int pluginIndex)` Sets whether or not the mapping is defined in a plugin.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface java.lang.Comparable` | `java.lang.Comparable#compareTo(java.lang.Object)`
    `interface UrlCreator` | `createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL, createURL, createURL, createURL`

- - ### Field Detail

    - #### java.lang.String ACTION

      The action this mapping matches

    - #### char AMPERSAND

    - #### java.lang.String ANY_HTTP_METHOD

      Constant used to define a Url mapping that matches any HTTP method

    - #### java.lang.String ANY_VERSION

      Constant used to define a Url mapping that matches any HTTP method

    - #### java.lang.String CAPTURED_DOUBLE_WILDCARD

    - #### java.lang.String CAPTURED_WILDCARD

    - #### java.lang.String CONTROLLER

      The controller this mapping matches

    - #### java.lang.String DOUBLE_WILDCARD

    - #### java.lang.String EXCEPTION

    - #### java.lang.String EXCLUDES

    - #### java.lang.String HTTP_METHOD

      The HTTP method this mapping matches

    - #### java.lang.String INCLUDES

    - #### java.util.Set<java.lang.String> KEYWORDS

    - #### java.lang.String NAMESPACE

      The namespace of the URL mapping

    - #### java.lang.String OPTIONAL_EXTENSION_WILDCARD

    - #### java.lang.String PERMANENT

    - #### java.lang.String PLUGIN

      The plugin of the URL Mapping

    - #### char QUESTION_MARK

    - #### java.lang.String REDIRECT_INFO

      Redirect information for this url mapping.

    - #### java.lang.String RESOURCES

    - #### java.lang.String SLASH

    - #### java.lang.String URI

      The URI of the URL mapping

    - #### java.lang.String VERSION

      The version of the URL mapping

    - #### java.lang.String VIEW

    - #### java.lang.String WILDCARD

  - ### Method Detail

    - #### public java.lang.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 groovy.lang.Closure or java.lang.String

    - #### public Constrained[] 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

    - #### public java.lang.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 groovy.lang.Closure or java.lang.String

    - #### public java.lang.String getHttpMethod()

      The HTTP method this URL mapping applies to. Will be null for all HTTP methods

      Returns:
        The HTTP method

    - #### public java.lang.String getMappingName()

      The name of the mapping in case of named URL mapping

      Returns:
        The mapping name

    - #### public java.lang.Object getNamespace()

      Returns:
        the name of the controller namespace

    - #### public java.lang.Integer getPluginIndex()

      Returns:
        The plugin index or null

    - #### public java.lang.Object getPluginName()

      The name of the plugin this URL mapping relates to, if any

      Returns:
        The plugin name

    - #### public java.lang.Object getRedirectInfo()

      The redirect information should be a String or a Map. If it is a String that string is the URI to redirect to. If it is a Map, that Map may contain any entries supported as arguments to the dynamic redirect(Map) method on a controller.

      Returns:
        redirect information for this url mapping

    - #### public UrlMappingData getUrlData()

      Retrieves the UrlMappingData instance that describes this UrlMapping

      Returns:
        The UrlMappingData instance

    - #### public java.lang.String getVersion()

      Returns:
        The version of the URL mapping. Used for versioning of REST services

    - #### public java.lang.Object getViewName()

      Returns the name of the view to map to

      Returns:
        The view name

    - #### public boolean hasRuntimeVariable(java.lang.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

    - #### public boolean isDefinedInPlugin()

      Returns:
        True if the URL mapping comes from a plugin

    - #### public UrlMappingInfo match(java.lang.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

    - #### public void setMappingName(java.lang.String name)

      Sets the name of the URL mapping

      Parameters:
        `name` - The name of the URL mapping

    - #### public void setParameterValues(java.util.Map parameterValues)

      Sets any parameter values that should be populated into the request

      Parameters:
        `parameterValues` - The parameter values to set

    - #### public void setParseRequest(boolean shouldParse)

      Sets whether this UrlMapping should parse the request

      Parameters:
        `shouldParse` - True if it should

    - #### public void setPluginIndex(int pluginIndex)

      Sets whether or not the mapping is defined in a plugin.

      Parameters:
        `pluginIndex` - The index of the plugin that defines this mapping