|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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, forwardURI, mappingName, parameterValues, parseRequest, restful, servletContext, viewName |
Fields inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping |
---|
ACTION, CONTROLLER |
Constructor Summary | |
---|---|
RegexUrlMapping(UrlMappingData data,
Object controllerName,
Object actionName,
Object viewName,
ConstrainedProperty[] constraints,
ServletContext servletContext)
Constructs a new RegexUrlMapping for the given pattern, controller name, action name and constraints. |
|
RegexUrlMapping(UrlMappingData data,
URI uri,
ConstrainedProperty[] constraints,
ServletContext servletContext)
Constructs a new RegexUrlMapipng for the given pattern that maps to the specified URI |
Method Summary | |
---|---|
int |
compareTo(Object o)
Compares this UrlMapping instance with the specified UrlMapping instance and deals with URL mapping precedence rules. |
protected Pattern |
convertToRegex(String url)
Converst a Grails URL provides via the UrlMappingData interface to a regular expression |
String |
createRelativeURL(String controller,
String action,
Map parameterValues,
String encoding)
Creates a URL for the given parameters values, controller and action names without the context path information |
String |
createRelativeURL(String controller,
String action,
Map parameterValues,
String encoding,
String fragment)
Creates a URL for the given parameters values, controller and action names without the context path information |
String |
createURL(Map parameterValues,
String encoding)
Creates a URL for the given parameter values |
String |
createURL(Map parameterValues,
String encoding,
String fragment)
Creates a URL for the given parameter values |
String |
createURL(String controller,
String action,
Map parameterValues,
String encoding)
Creates a URL for the given parameters values, controller and action names |
String |
createURL(String controller,
String action,
Map parameterValues,
String encoding,
String fragment)
Creates a URL for the given parameters values, controller and action names |
String[] |
getLogicalMappings()
|
UrlMappingData |
getUrlData()
Retrieves the UrlMappingData instance that describes this UrlMapping |
UrlMappingInfo |
match(String uri)
Matches the given URI and returns a DefaultUrlMappingInfo instance or null |
String |
toString()
|
Methods inherited from class org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping |
---|
getActionName, getConstraints, getControllerName, getMappingName, getViewName, hasRuntimeVariable, isRestfulMapping, setMappingName, setParameterValues, setParseRequest, setRestfulMapping |
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, getMappingName, getViewName, hasRuntimeVariable, isRestfulMapping, setMappingName, setParameterValues, setParseRequest, setRestfulMapping |
Constructor Detail |
---|
public RegexUrlMapping(UrlMappingData data, Object controllerName, Object actionName, Object viewName, ConstrainedProperty[] constraints, ServletContext servletContext)
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 URLservletContext
- ConstrainedProperty
public RegexUrlMapping(UrlMappingData data, URI uri, ConstrainedProperty[] constraints, ServletContext servletContext)
data
- The patternuri
- The URIconstraints
- Any constraints etc.servletContext
- The servlet contextMethod Detail |
---|
protected Pattern convertToRegex(String url)
url
- The URL to convert
public UrlMappingInfo match(String uri)
match
in interface UrlMapping
uri
- The URI to match
UrlMappingInfo
public String createURL(Map parameterValues, String encoding)
UrlCreator
createURL
in interface UrlCreator
parameterValues
- The parameter valuesencoding
- The encoding to use for parameters
UrlMapping
public String createURL(Map parameterValues, String encoding, 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 String createURL(String controller, String action, Map parameterValues, String encoding)
UrlCreator
createURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parameters
public String createRelativeURL(String controller, String action, Map parameterValues, String encoding)
UrlCreator
createRelativeURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parameters
public String createRelativeURL(String controller, String action, Map parameterValues, String encoding, String fragment)
UrlCreator
createRelativeURL
in interface UrlCreator
controller
- The controller nameaction
- The action nameparameterValues
- The parameter valuesencoding
- The encoding to use for parametersfragment
- The fragment to append to the end
public String createURL(String controller, String action, Map parameterValues, String encoding, 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 String[] getLogicalMappings()
public int compareTo(Object o)
compareTo
in interface Comparable
o
- An instance of the UrlMapping interface
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |