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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACTION
The action this mapping matches
|
static char |
AMPERSAND |
static java.lang.String |
ANY_HTTP_METHOD
Constant used to define a Url mapping that matches any HTTP method
|
static java.lang.String |
ANY_VERSION
Constant used to define a Url mapping that matches any HTTP method
|
static java.lang.String |
CAPTURED_DOUBLE_WILDCARD |
static java.lang.String |
CAPTURED_WILDCARD |
static java.lang.String |
CONTROLLER
The controller this mapping matches
|
static java.lang.String |
DOUBLE_WILDCARD |
static java.lang.String |
HTTP_METHOD
The HTTP method this mapping matches
|
static java.lang.String |
NAMESPACE
The namespace of the URL mapping
|
static java.lang.String |
OPTIONAL_EXTENSION_WILDCARD |
static java.lang.String |
PLUGIN
The plugin of the URL Mapping
|
static char |
QUESTION_MARK |
static java.lang.String |
REDIRECT_INFO
Redirect information for this url mapping.
|
static java.lang.String |
SLASH |
static java.lang.String |
URI
The URI of the URL mapping
|
static java.lang.String |
VERSION
The version of the URL mapping
|
static java.lang.String |
WILDCARD |
| Modifier and Type | Method and Description |
|---|---|
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
|
org.codehaus.groovy.grails.validation.ConstrainedProperty[] |
getConstraints()
The constraints the apply to this UrlMapping.
|
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
|
java.lang.String |
getHttpMethod()
The HTTP method this URL mapping applies to.
|
java.lang.String |
getMappingName()
The name of the mapping in case of named URL mapping
|
java.lang.Object |
getNamespace() |
java.lang.Object |
getPluginName()
The name of the plugin this URL mapping relates to, if any
|
java.lang.Object |
getRedirectInfo()
The redirect information should be a String or a Map.
|
UrlMappingData |
getUrlData()
Retrieves the UrlMappingData instance that describes this UrlMapping
|
java.lang.String |
getVersion() |
java.lang.Object |
getViewName()
Returns the name of the view to map to
|
boolean |
hasRuntimeVariable(java.lang.String name)
Whether the mapping has a runtime variable with the given name such as "/$foo"
|
boolean |
isRestfulMapping() |
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
|
void |
setMappingName(java.lang.String name)
Sets the name of the URL mapping
|
void |
setParameterValues(java.util.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) |
createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL, createURL, createURL, createURLstatic final java.lang.String WILDCARD
static final java.lang.String CAPTURED_WILDCARD
static final java.lang.String OPTIONAL_EXTENSION_WILDCARD
static final java.lang.String SLASH
static final char QUESTION_MARK
static final char AMPERSAND
static final java.lang.String DOUBLE_WILDCARD
static final java.lang.String CAPTURED_DOUBLE_WILDCARD
static final java.lang.String CONTROLLER
static final java.lang.String ACTION
static final java.lang.String HTTP_METHOD
static final java.lang.String REDIRECT_INFO
static final java.lang.String ANY_HTTP_METHOD
static final java.lang.String VERSION
static final java.lang.String ANY_VERSION
static final java.lang.String URI
static final java.lang.String PLUGIN
static final java.lang.String NAMESPACE
UrlMappingInfo match(java.lang.String uri)
uri - The URI to matchUrlMappingData getUrlData()
org.codehaus.groovy.grails.validation.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
java.lang.Object getControllerName()
Closure or Stringjava.lang.Object getActionName()
Closure or Stringjava.lang.Object getPluginName()
java.lang.Object getNamespace()
java.lang.Object getViewName()
java.lang.String getHttpMethod()
java.lang.String getVersion()
void setParameterValues(java.util.Map parameterValues)
parameterValues - The parameter values to setvoid setParseRequest(boolean shouldParse)
shouldParse - True if it shouldjava.lang.String getMappingName()
void setMappingName(java.lang.String name)
name - The name of the URL mappingvoid setRestfulMapping(boolean isREST)
isREST - Set whether this is a RESTful mappingboolean isRestfulMapping()
boolean hasRuntimeVariable(java.lang.String name)
name - The name of the variablejava.lang.Object getRedirectInfo()