Package org.grails.web.mapping
Class AbstractUrlMapping
- java.lang.Object
-
- org.grails.web.mapping.AbstractUrlMapping
-
- All Implemented Interfaces:
UrlCreator,UrlMapping,java.lang.Comparable
- Direct Known Subclasses:
RegexUrlMapping,ResponseCodeUrlMapping
public abstract class AbstractUrlMapping extends java.lang.Object implements UrlMapping
Abstract UrlMapping implementation that provides common basic functionality.- Since:
- 0.5.5
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ObjectactionNameprotected grails.gorm.validation.ConstrainedProperty[]constraintsprotected java.lang.ObjectcontrollerNameprotected java.lang.ObjectforwardURIprotected grails.core.GrailsApplicationgrailsApplicationprotected java.lang.StringhttpMethodprotected java.lang.StringmappingNameprotected java.lang.Objectnamespaceprotected java.util.MapparameterValuesprotected booleanparseRequestprotected java.lang.IntegerpluginIndexprotected java.lang.ObjectpluginNameprotected java.lang.ObjectredirectInfoprotected javax.servlet.ServletContextservletContextprotected java.lang.Stringversionprotected java.lang.ObjectviewName-
Fields inherited from interface grails.web.mapping.UrlMapping
ACTION, AMPERSAND, ANY_HTTP_METHOD, ANY_VERSION, CAPTURED_DOUBLE_WILDCARD, CAPTURED_WILDCARD, CONTROLLER, DOUBLE_WILDCARD, EXCEPTION, EXCLUDES, HTTP_METHOD, INCLUDES, KEYWORDS, NAMESPACE, OPTIONAL_EXTENSION_WILDCARD, PERMANENT, PLUGIN, QUESTION_MARK, REDIRECT_INFO, RESOURCES, SLASH, URI, VERSION, VIEW, WILDCARD
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUrlMapping(java.lang.Object viewName, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)AbstractUrlMapping(java.lang.Object redirectInfo, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)Base constructor required to construct a UrlMapping instanceprotectedAbstractUrlMapping(java.net.URI uri, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetActionName()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 namegrails.gorm.validation.Constrained[]getConstraints()The constraints the apply to this UrlMapping.java.lang.ObjectgetControllerName()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 namejava.lang.StringgetHttpMethod()The HTTP method this URL mapping applies to.java.lang.StringgetMappingName()The name of the mapping in case of named URL mappingjava.lang.ObjectgetNamespace()java.lang.IntegergetPluginIndex()java.lang.ObjectgetPluginName()The name of the plugin this URL mapping relates to, if anyjava.lang.ObjectgetRedirectInfo()The redirect information should be a String or a Map.java.lang.StringgetVersion()java.lang.ObjectgetViewName()Returns the name of the view to map tobooleanhasRuntimeVariable(java.lang.String name)Whether the mapping has a runtime variable with the given name such as "/$foo"booleanisDefinedInPlugin()voidsetMappingName(java.lang.String name)Sets the name of the URL mappingvoidsetParameterValues(java.util.Map parameterValues)Sets any parameter values that should be populated into the requestvoidsetParseRequest(boolean shouldParse)Sets whether this UrlMapping should parse the requestvoidsetPluginIndex(int pluginIndex)Sets whether or not the mapping is defined in a plugin.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface grails.web.mapping.UrlCreator
createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createRelativeURL, createURL, createURL, createURL, createURL, createURL, createURL, createURL
-
Methods inherited from interface grails.web.mapping.UrlMapping
getUrlData, match
-
-
-
-
Field Detail
-
constraints
protected final grails.gorm.validation.ConstrainedProperty[] constraints
-
controllerName
protected java.lang.Object controllerName
-
actionName
protected java.lang.Object actionName
-
namespace
protected java.lang.Object namespace
-
pluginName
protected java.lang.Object pluginName
-
viewName
protected java.lang.Object viewName
-
forwardURI
protected java.lang.Object forwardURI
-
redirectInfo
protected java.lang.Object redirectInfo
-
servletContext
protected javax.servlet.ServletContext servletContext
-
grailsApplication
protected grails.core.GrailsApplication grailsApplication
-
parameterValues
protected java.util.Map parameterValues
-
parseRequest
protected boolean parseRequest
-
mappingName
protected java.lang.String mappingName
-
httpMethod
protected java.lang.String httpMethod
-
version
protected java.lang.String version
-
pluginIndex
protected java.lang.Integer pluginIndex
-
-
Constructor Detail
-
AbstractUrlMapping
public AbstractUrlMapping(java.lang.Object redirectInfo, java.lang.Object controllerName, java.lang.Object actionName, java.lang.Object namespace, java.lang.Object pluginName, java.lang.Object viewName, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)Base constructor required to construct a UrlMapping instance- Parameters:
controllerName- The name of the controlleractionName- The name of the actionconstraints- Any constraints that apply to the mappinggrailsApplication- The GrailsApplication instance
-
AbstractUrlMapping
protected AbstractUrlMapping(java.lang.Object viewName, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)
-
AbstractUrlMapping
protected AbstractUrlMapping(java.net.URI uri, grails.gorm.validation.ConstrainedProperty[] constraints, grails.core.GrailsApplication grailsApplication)
-
-
Method Detail
-
getHttpMethod
public java.lang.String getHttpMethod()
Description copied from interface:UrlMappingThe HTTP method this URL mapping applies to. Will be null for all HTTP methods- Specified by:
getHttpMethodin interfaceUrlMapping- Returns:
- The HTTP method
-
getVersion
public java.lang.String getVersion()
- Specified by:
getVersionin interfaceUrlMapping- Returns:
- The version of the URL mapping. Used for versioning of REST services
-
getConstraints
public grails.gorm.validation.Constrained[] getConstraints()
Description copied from interface:UrlMappingThe 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
- Specified by:
getConstraintsin interfaceUrlMapping- Returns:
- An array containing the ConstrainedProperty objects of this URLMapping
- See Also:
UrlMapping.getConstraints()
-
getControllerName
public java.lang.Object getControllerName()
Description copied from interface:UrlMappingRetrieves 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- Specified by:
getControllerNamein interfaceUrlMapping- Returns:
- The controller name as a
ClosureorString - See Also:
UrlMapping.getControllerName()
-
getActionName
public java.lang.Object getActionName()
Description copied from interface:UrlMappingRetrieves 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- Specified by:
getActionNamein interfaceUrlMapping- Returns:
- The action name as a
ClosureorString - See Also:
UrlMapping.getActionName()
-
getPluginName
public java.lang.Object getPluginName()
Description copied from interface:UrlMappingThe name of the plugin this URL mapping relates to, if any- Specified by:
getPluginNamein interfaceUrlMapping- Returns:
- The plugin name
-
getNamespace
public java.lang.Object getNamespace()
- Specified by:
getNamespacein interfaceUrlMapping- Returns:
- the name of the controller namespace
-
getViewName
public java.lang.Object getViewName()
Description copied from interface:UrlMappingReturns the name of the view to map to- Specified by:
getViewNamein interfaceUrlMapping- Returns:
- The view name
- See Also:
UrlMapping.getViewName()
-
setParameterValues
public void setParameterValues(java.util.Map parameterValues)
Description copied from interface:UrlMappingSets any parameter values that should be populated into the request- Specified by:
setParameterValuesin interfaceUrlMapping- Parameters:
parameterValues- The parameter values to set
-
setParseRequest
public void setParseRequest(boolean shouldParse)
Description copied from interface:UrlMappingSets whether this UrlMapping should parse the request- Specified by:
setParseRequestin interfaceUrlMapping- Parameters:
shouldParse- True if it should
-
getMappingName
public java.lang.String getMappingName()
Description copied from interface:UrlMappingThe name of the mapping in case of named URL mapping- Specified by:
getMappingNamein interfaceUrlMapping- Returns:
- The mapping name
-
setMappingName
public void setMappingName(java.lang.String name)
Description copied from interface:UrlMappingSets the name of the URL mapping- Specified by:
setMappingNamein interfaceUrlMapping- Parameters:
name- The name of the URL mapping
-
hasRuntimeVariable
public boolean hasRuntimeVariable(java.lang.String name)
Description copied from interface:UrlMappingWhether the mapping has a runtime variable with the given name such as "/$foo"- Specified by:
hasRuntimeVariablein interfaceUrlMapping- Parameters:
name- The name of the variable- Returns:
- true if the mapping has the variable
-
getRedirectInfo
public java.lang.Object getRedirectInfo()
Description copied from interface:UrlMappingThe redirect information should be a String or a Map. If it is a String that string is the URI to redirect to. If it is a Map, that Map may contain any entries supported as arguments to the dynamic redirect(Map) method on a controller.- Specified by:
getRedirectInfoin interfaceUrlMapping- Returns:
- redirect information for this url mapping
-
setPluginIndex
public void setPluginIndex(int pluginIndex)
Description copied from interface:UrlMappingSets whether or not the mapping is defined in a plugin.- Specified by:
setPluginIndexin interfaceUrlMapping- Parameters:
pluginIndex- The index of the plugin that defines this mapping
-
getPluginIndex
public java.lang.Integer getPluginIndex()
- Specified by:
getPluginIndexin interfaceUrlMapping- Returns:
- The plugin index or null
-
isDefinedInPlugin
public boolean isDefinedInPlugin()
- Specified by:
isDefinedInPluginin interfaceUrlMapping- Returns:
- True if the URL mapping comes from a plugin
-
-