Groovy Documentation

org.codehaus.groovy.grails.web.mapping
[Java] Interface UrlMapping

org.codehaus.groovy.grails.web.mapping.UrlMapping
  org.codehaus.groovy.grails.web.mapping.UrlCreator
All Superinterfaces:
UrlCreator

@SuppressWarnings("rawtypes")
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.

Authors:
Graeme Rocher
Since:
0.5


Field Summary
java.lang.String ACTION

java.lang.String CONTROLLER

 
Method Summary
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

ConstrainedProperty[] getConstraints()

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 getMappingName()

UrlMappingData getUrlData()

Retrieves the UrlMappingData instance that describes this UrlMapping

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()

@return Whether this is a RESTful mapping

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)

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)

@param isREST Set whether this is a RESTful mapping

 
Methods inherited from interface java.lang.Comparable
java.lang.Comparable#compareTo(java.lang.Object)
 
Methods inherited from interface UrlCreator
createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL
 

Field Detail

ACTION

public java.lang.String ACTION


CONTROLLER

public java.lang.String CONTROLLER


 
Method Detail

getActionName

public 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
Returns:
The action name as a groovy.lang.Closure or java.lang.String


getConstraints

public 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

Returns:
An array containing the ConstrainedProperty objects of this URLMapping


getControllerName

public 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
Returns:
The controller name as a groovy.lang.Closure or java.lang.String


getMappingName

public java.lang.String getMappingName()


getUrlData

public UrlMappingData getUrlData()
Retrieves the UrlMappingData instance that describes this UrlMapping
Returns:
The UrlMappingData instance


getViewName

public java.lang.Object getViewName()
Returns the name of the view to map to
Returns:
The view name


hasRuntimeVariable

public boolean hasRuntimeVariable(java.lang.String name)
Whether the mapping has a runtime variable with the given name such as "/$foo"
Parameters:
name - The name of the variable
Returns:
True if the mapping has the variable


isRestfulMapping

public boolean isRestfulMapping()
Returns:
Whether this is a RESTful mapping


match

public 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
Parameters:
uri - The URI to match
Returns:
An instance of UrlMappingInfo or null if the URI doesn't match


setMappingName

public void setMappingName(java.lang.String name)


setParameterValues

public void setParameterValues(java.util.Map parameterValues)
Sets any parameter values that should be populated into the request
Parameters:
parameterValues - The parameter values to set


setParseRequest

public void setParseRequest(boolean shouldParse)
Sets whether this UrlMapping should parse the request
Parameters:
shouldParse - True if it should


setRestfulMapping

public void setRestfulMapping(boolean isREST)
Parameters:
isREST - Set whether this is a RESTful mapping


 

Groovy Documentation