|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
org.codehaus.groovy.grails.web.mapping.RegexUrlMapping
public class RegexUrlMapping
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
AntPathMatcher
Field Summary |
---|
Fields inherited from class org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping |
---|
actionName, constraints, controllerName, parameterValues, viewName |
Fields inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping |
---|
ACTION, CONTROLLER |
Constructor Summary | |
---|---|
RegexUrlMapping(UrlMappingData data,
java.lang.Object controllerName,
java.lang.Object actionName,
java.lang.Object viewName,
ConstrainedProperty[] constraints)
Constructs a new RegexUrlMapping for the given pattern, controller name, action name and constraints. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Compares this UrlMapping instance with the specified UrlMapping instance and deals with URL mapping precedence rules. |
protected java.util.regex.Pattern |
convertToRegex(java.lang.String url)
Converst 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 parameterValues,
java.lang.String encoding)
Creates a URL for the given parameters values, controller and action names without the context path information |
java.lang.String |
createURL(java.util.Map parameterValues,
java.lang.String encoding)
Creates a URL for the given parameter values |
java.lang.String |
createURL(java.util.Map parameterValues,
java.lang.String encoding,
java.lang.String fragment)
Creates a URL for the given parameter values |
java.lang.String |
createURL(java.lang.String controller,
java.lang.String action,
java.util.Map parameterValues,
java.lang.String encoding)
Creates a URL for the given parameters values, controller and action names |
java.lang.String |
createURL(java.lang.String controller,
java.lang.String action,
java.util.Map parameterValues,
java.lang.String encoding,
java.lang.String fragment)
Creates a URL for the given parameters values, controller and action names |
java.lang.String[] |
getLogicalMappings()
|
UrlMappingData |
getUrlData()
Retrieves the UrlMappingData instance that describes this UrlMapping |
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 org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping |
---|
getActionName, getConstraints, getControllerName, getViewName, setParameterValues |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping |
---|
getActionName, getConstraints, getControllerName, getViewName, setParameterValues |
Constructor Detail |
---|
public RegexUrlMapping(UrlMappingData data, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object viewName, ConstrainedProperty[] constraints)
data
- An instance of the UrlMappingData class that holds necessary information of the URL mappingcontrollerName
- The name of the controller the URL maps to (required)actionName
- The name of the action the URL maps toviewName
- 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 mappingconstraints
- A list of ConstrainedProperty instances that relate to tokens in the URLConstrainedProperty
Method Detail |
---|
protected java.util.regex.Pattern convertToRegex(java.lang.String url)
url
- The URL to convert
public UrlMappingInfo match(java.lang.String uri)
match
in interface UrlMapping
uri
- The URI to match
UrlMappingInfo
public java.lang.String createURL(java.util.Map parameterValues, java.lang.String encoding)
UrlCreator
createURL
in interface UrlCreator
parameterValues
- The parameter valuesencoding
- The encoding to use for parameters
UrlMapping
public java.lang.String createURL(java.util.Map parameterValues, java.lang.String encoding, java.lang.String fragment)
UrlCreator
createURL
in interface UrlCreator
parameterValues
- The parameter valuesencoding
- The encoding to use for parametersfragment
- The URL fragment to be appended to the URL following a #
public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.util.Map parameterValues, java.lang.String encoding)
UrlCreator
createURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parameters
public java.lang.String createRelativeURL(java.lang.String controller, java.lang.String action, java.util.Map parameterValues, java.lang.String encoding)
UrlCreator
createRelativeURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parameters
public java.lang.String createURL(java.lang.String controller, java.lang.String action, java.util.Map parameterValues, java.lang.String encoding, java.lang.String fragment)
UrlCreator
createURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parametersfragment
- The URL fragment to be appended to the URL following a #
public UrlMappingData getUrlData()
UrlMapping
getUrlData
in interface UrlMapping
public java.lang.String[] getLogicalMappings()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- An instance of the UrlMapping interface
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |