Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.mapping
[Java] Class RegexUrlMapping

    java.lang.Object
      org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
          org.codehaus.groovy.grails.web.mapping.RegexUrlMapping

    @java.lang.SuppressWarnings("rawtypes")
    public class RegexUrlMapping
    extends AbstractUrlMapping

A UrlMapping implementation that takes a Grails URL pattern and turns it into a regex matcher so that URLs can be matched and information captured from the match.

A Grails URL pattern is not a regex, but is an extension to the form defined by Apache Ant and used by Spring AntPathMatcher. Unlike regular Ant paths Grails URL patterns allow for capturing groups in the form:

`/blog/(*)/**`

The parenthesis define a capturing group. This implementation transforms regular Ant paths into regular expressions that are able to use capturing groups

Authors:
  Graeme Rocher

See Also:
  org.springframework.util.AntPathMatcher

Since:
  0.5

Field Summary
`static java.util.regex.Pattern` | `DOUBLE_WILDCARD_PATTERN`
`static java.util.regex.Pattern` | `OPTIONAL_EXTENSION_WILDCARD_PATTERN`

Fields inherited from class AbstractUrlMapping
actionName, constraints, controllerName, forwardURI, httpMethod, mappingName, namespace, parameterValues, parseRequest, pluginName, redirectInfo, restful, servletContext, version, viewName

Constructor Summary
`RegexUrlMapping(UrlMappingData data, java.net.URI uri, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)` Constructs a new RegexUrlMapping for the given pattern that maps to the specified URI
`RegexUrlMapping(UrlMappingData data, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, java.lang.String httpMethod, java.lang.String version, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)`
`RegexUrlMapping(java.lang.Object redirectInfo, UrlMappingData data, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, java.lang.String httpMethod, java.lang.String version, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)` Constructs a new RegexUrlMapping for the given pattern, controller name, action name and constraints.

Method Summary
`int` | `compareTo(java.lang.Object o)`
`protected java.util.regex.Pattern` | `convertToRegex(java.lang.String url)` Converts a Grails URL provides via the UrlMappingData interface to a regular expression.
`java.lang.String` | `createRelativeURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding)`
`java.lang.String` | `createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)`
`java.lang.String` | `createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)`
`java.lang.String` | `createRelativeURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)`
`java.lang.String` | `createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)`
`java.lang.String` | `createURL(java.util.Map paramValues, java.lang.String encoding)` @see org.codehaus.groovy.grails.web.mapping.UrlMapping
`java.lang.String` | `createURL(java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)`
`java.lang.String` | `createURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding)`
`java.lang.String` | `createURL(java.lang.String controller, java.lang.String action, java.lang.String pluginName, java.util.Map parameterValues, java.lang.String encoding)`
`java.lang.String` | `createURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)`
`java.lang.String` | `createURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)`
`java.lang.String` | `createURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)`
`protected java.lang.String` | `encode(java.lang.String s, java.lang.String encoding)`
`java.lang.String[]` | `getLogicalMappings()`
`UrlMappingData` | `getUrlData()`
`UrlMappingInfo` | `match(java.lang.String uri)` Matches the given URI and returns a DefaultUrlMappingInfo instance or null
`java.lang.String` | `toString()`

Methods inherited from class AbstractUrlMapping
getActionName, getConstraints, getControllerName, getHttpMethod, getMappingName, getNamespace, getPluginName, getRedirectInfo, getVersion, getViewName, hasRuntimeVariable, isRestfulMapping, setMappingName, setParameterValues, setParseRequest, setRestfulMapping

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### DOUBLE_WILDCARD_PATTERN

    public static final java.util.regex.Pattern DOUBLE_WILDCARD_PATTERN

### OPTIONAL_EXTENSION_WILDCARD_PATTERN

    public static final java.util.regex.Pattern OPTIONAL_EXTENSION_WILDCARD_PATTERN

Constructor Detail

### RegexUrlMapping

    public RegexUrlMapping(UrlMappingData data, java.net.URI uri, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)

  Constructs a new RegexUrlMapping for the given pattern that maps to the specified URI
  Parameters:
    `data` - The pattern
    `uri` - The URI
    `constraints` - Any constraints etc.
    `servletContext` - The servlet context

### RegexUrlMapping

    public RegexUrlMapping(UrlMappingData data, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, java.lang.String httpMethod, java.lang.String version, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)

### RegexUrlMapping

    public RegexUrlMapping(java.lang.Object redirectInfo, UrlMappingData data, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, java.lang.String httpMethod, java.lang.String version, ConstrainedProperty[] constraints, javax.servlet.ServletContext servletContext)

  Constructs a new RegexUrlMapping for the given pattern, controller name, action name and constraints.
  Parameters:
    `data` - An instance of the UrlMappingData class that holds necessary information of the URL mapping
    `controllerName` - The name of the controller the URL maps to (required)
    `actionName` - The name of the action the URL maps to
    `namespace` - The controller namespace
    `pluginName` - The name of the plugin which provided the controller
    `viewName` - The name of the view as an alternative to the name of the action. If the action is specified it takes precedence over the view name during mapping
    `httpMethod` - The http method
    `version` - The version
    `constraints` - A list of ConstrainedProperty instances that relate to tokens in the URL
    servletContext
  See Also:
    ConstrainedProperty

Method Detail

### compareTo

    public int compareTo(java.lang.Object o)

### convertToRegex

    protected java.util.regex.Pattern convertToRegex(java.lang.String url)

  Converts a Grails URL provides via the UrlMappingData interface to a regular expression.
  Parameters:
    `url` - The URL to convert
  Returns:
    A regex Pattern objet

### createRelativeURL

    public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding)

### createRelativeURL

    public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)

### createRelativeURL

    public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)

### createRelativeURL

    public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)

### createRelativeURL

    public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)

### createURL

    public java.lang.String createURL(java.util.Map paramValues, java.lang.String encoding)

  See Also:
    UrlMapping

### createURL

    public java.lang.String createURL(java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)

### createURL

    public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding)

### createURL

    public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.lang.String pluginName, java.util.Map parameterValues, java.lang.String encoding)

### createURL

    public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding)

### createURL

    public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)

### createURL

    public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.lang.String namespace, java.lang.String pluginName, java.util.Map paramValues, java.lang.String encoding, java.lang.String fragment)

### encode

    protected java.lang.String encode(java.lang.String s, java.lang.String encoding)

### getLogicalMappings

    public java.lang.String[] getLogicalMappings()

### getUrlData

    public UrlMappingData getUrlData()

### match

    public UrlMappingInfo match(java.lang.String uri)

  Matches the given URI and returns a DefaultUrlMappingInfo instance or null
  Parameters:
    `uri` - The URI to match
  Returns:
    A UrlMappingInfo instance or null
  See Also:
    UrlMappingInfo

### toString

    @java.lang.Override
    public java.lang.String toString()

Groovy Documentation