|
||||||||||
| 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,
Object controllerName,
Object actionName,
Object viewName,
ConstrainedProperty[] constraints)
Constructs a new RegexUrlMapping for the given pattern, controller name, action name and constraints. |
|
| 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 |
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, 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,
Object controllerName,
Object actionName,
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 Pattern convertToRegex(String url)
url - The URL to convert
public UrlMappingInfo match(String uri)
match in interface UrlMappinguri - The URI to match
UrlMappingInfo
public String createURL(Map parameterValues,
String encoding)
UrlCreator
createURL in interface UrlCreatorparameterValues - The parameter valuesencoding - The encoding to use for parameters
UrlMapping
public String createURL(Map parameterValues,
String encoding,
String fragment)
UrlCreator
createURL in interface UrlCreatorparameterValues - 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 UrlCreatorcontroller - 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 UrlCreatorcontroller - The controller nameaction - The action nameparameterValues - The parameter valuesencoding - The encoding to use for parameters
public String createURL(String controller,
String action,
Map parameterValues,
String encoding,
String fragment)
UrlCreator
createURL in interface UrlCreatorcontroller - 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 UrlMappingpublic String[] getLogicalMappings()
public int compareTo(Object o)
compareTo in interface Comparableo - 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 | |||||||||