Package grails.web.mapping
Interface UrlMappingData
-
- All Known Implementing Classes:
DefaultUrlMappingData,ResponseCodeMappingData
public interface UrlMappingDataHolds information about a parsed URL such as the tokens that make up the URL, The URLs (plural) that the UrLMapping logically maps to and so forth
- Since:
- 0.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UrlMappingDatacreateRelative(java.lang.String path)Creates a new UrlMappingData instance relative to this one for the given pathjava.lang.String[]getLogicalUrls()Obtains the logical URLs for this URLjava.lang.String[]getTokens()Retrieves the tokens that make up a URL.java.lang.StringgetUrlPattern()Retrieves the URL pattern for this UrlMappingData instancebooleanhasOptionalExtension()booleanisOptional(int index)Returns whether the given token in the URL is optional.
-
-
-
Method Detail
-
getTokens
java.lang.String[] getTokens()
Retrieves the tokens that make up a URL. For example the tokens for the URL /blog/2007/* would be "blog", "2007" and "*"
- Returns:
- The tokens as a string array
-
getLogicalUrls
java.lang.String[] getLogicalUrls()
Obtains the logical URLs for this URL
- Returns:
- The logical URLs as a string array
-
getUrlPattern
java.lang.String getUrlPattern()
Retrieves the URL pattern for this UrlMappingData instance- Returns:
- The URL pattern
-
isOptional
boolean isOptional(int index)
Returns whether the given token in the URL is optional. The index takes into account matching groups so for example the URL /blog/(*)/(*) has two entries for the two (*) matching groups with the index 0 relating to the the first entry- Parameters:
index- The index of the matching token- Returns:
- True if it is optional
-
createRelative
UrlMappingData createRelative(java.lang.String path)
Creates a new UrlMappingData instance relative to this one for the given path- Parameters:
path- The path- Returns:
- The new instance
-
hasOptionalExtension
boolean hasOptionalExtension()
- Returns:
- Whether the pattern has an optional extension
-
-