org.codehaus.groovy.grails.web.mapping
Class ResponseCodeUrlMapping

java.lang.Object
  extended by org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
      extended by org.codehaus.groovy.grails.web.mapping.ResponseCodeUrlMapping
All Implemented Interfaces:
Comparable, UrlCreator, UrlMapping

public class ResponseCodeUrlMapping
extends AbstractUrlMapping
implements UrlMapping

A Url mapping for http response codes

Since:
1.0-RC1
Author:
mike

Field Summary
 
Fields inherited from class org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
actionName, controllerName, forwardURI, mappingName, parseRequest, restful, servletContext, viewName
 
Fields inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping
ACTION, CONTROLLER
 
Constructor Summary
ResponseCodeUrlMapping(UrlMappingData urlData, Object controllerName, Object actionName, Object viewName, ConstrainedProperty[] constraints, ServletContext servletContext)
           
 
Method Summary
 int compareTo(Object o)
           
 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
 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()
          The constraints the apply to this UrlMapping.
 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
 Class getExceptionType()
           
 UrlMappingData getUrlData()
          Retrieves the UrlMappingData instance that describes this UrlMapping
 Object getViewName()
          Returns the name of the view to map to
 UrlMappingInfo match(int responseCode)
           
 UrlMappingInfo match(String uri)
          Matches the given URI and returns an instance of the UrlMappingInfo interface or null if a match couldn't be established
 void setExceptionType(Class exClass)
           
 void setParameterValues(Map parameterValues)
          Sets any parameter values that should be populated into the request
 
Methods inherited from class org.codehaus.groovy.grails.web.mapping.AbstractUrlMapping
getMappingName, hasRuntimeVariable, isRestfulMapping, setMappingName, setParseRequest, setRestfulMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMapping
getMappingName, hasRuntimeVariable, isRestfulMapping, setMappingName, setParseRequest, setRestfulMapping
 

Constructor Detail

ResponseCodeUrlMapping

public ResponseCodeUrlMapping(UrlMappingData urlData,
                              Object controllerName,
                              Object actionName,
                              Object viewName,
                              ConstrainedProperty[] constraints,
                              ServletContext servletContext)
Method Detail

match

public UrlMappingInfo match(String uri)
Description copied from interface: UrlMapping
Matches the given URI and returns an instance of the UrlMappingInfo interface or null if a match couldn't be established

Specified by:
match in interface UrlMapping
Parameters:
uri - The URI to match
Returns:
An instance of UrlMappingInfo or null if the URI doesn't match

getUrlData

public UrlMappingData getUrlData()
Description copied from interface: UrlMapping
Retrieves the UrlMappingData instance that describes this UrlMapping

Specified by:
getUrlData in interface UrlMapping
Returns:
The UrlMappingData instance

getConstraints

public ConstrainedProperty[] getConstraints()
Description copied from interface: UrlMapping

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

Specified by:
getConstraints in interface UrlMapping
Overrides:
getConstraints in class AbstractUrlMapping
Returns:
An array containing the ConstrainedProperty objects of this URLMapping
See Also:
UrlMapping.getConstraints()

getControllerName

public Object getControllerName()
Description copied from interface: UrlMapping
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

Specified by:
getControllerName in interface UrlMapping
Overrides:
getControllerName in class AbstractUrlMapping
Returns:
The controller name as a Closure or String
See Also:
UrlMapping.getControllerName()

getActionName

public Object getActionName()
Description copied from interface: UrlMapping
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

Specified by:
getActionName in interface UrlMapping
Overrides:
getActionName in class AbstractUrlMapping
Returns:
The action name as a Closure or String
See Also:
UrlMapping.getActionName()

getViewName

public Object getViewName()
Description copied from interface: UrlMapping
Returns the name of the view to map to

Specified by:
getViewName in interface UrlMapping
Overrides:
getViewName in class AbstractUrlMapping
Returns:
The view name
See Also:
UrlMapping.getViewName()

setParameterValues

public void setParameterValues(Map parameterValues)
Description copied from interface: UrlMapping
Sets any parameter values that should be populated into the request

Specified by:
setParameterValues in interface UrlMapping
Overrides:
setParameterValues in class AbstractUrlMapping
Parameters:
parameterValues - The parameter values to set

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

createURL

public String createURL(Map parameterValues,
                        String encoding)
Description copied from interface: UrlCreator
Creates a URL for the given parameter values

Specified by:
createURL in interface UrlCreator
Parameters:
parameterValues - The parameter values
encoding - The encoding to use for parameters
Returns:
Returns the created URL for the given parameter values

createURL

public String createURL(Map parameterValues,
                        String encoding,
                        String fragment)
Description copied from interface: UrlCreator
Creates a URL for the given parameter values

Specified by:
createURL in interface UrlCreator
Parameters:
parameterValues - The parameter values
encoding - The encoding to use for parameters
fragment - The URL fragment to be appended to the URL following a #
Returns:
Returns the created URL for the given parameter values

createURL

public String createURL(String controller,
                        String action,
                        Map parameterValues,
                        String encoding)
Description copied from interface: UrlCreator
Creates a URL for the given parameters values, controller and action names

Specified by:
createURL in interface UrlCreator
Parameters:
controller - The controller name
action - The action name
parameterValues - The parameter values
encoding - The encoding to use for parameters
Returns:
The created URL for the given arguments

createRelativeURL

public String createRelativeURL(String controller,
                                String action,
                                Map parameterValues,
                                String encoding)
Description copied from interface: UrlCreator
Creates a URL for the given parameters values, controller and action names without the context path information

Specified by:
createRelativeURL in interface UrlCreator
Parameters:
controller - The controller name
action - The action name
parameterValues - The parameter values
encoding - The encoding to use for parameters
Returns:
The created URL for the given arguments

createRelativeURL

public String createRelativeURL(String controller,
                                String action,
                                Map parameterValues,
                                String encoding,
                                String fragment)
Description copied from interface: UrlCreator
Creates a URL for the given parameters values, controller and action names without the context path information

Specified by:
createRelativeURL in interface UrlCreator
Parameters:
controller - The controller name
action - The action name
parameterValues - The parameter values
encoding - The encoding to use for parameters
fragment - The fragment to append to the end
Returns:
The created URL for the given arguments

createURL

public String createURL(String controller,
                        String action,
                        Map parameterValues,
                        String encoding,
                        String fragment)
Description copied from interface: UrlCreator
Creates a URL for the given parameters values, controller and action names

Specified by:
createURL in interface UrlCreator
Parameters:
controller - The controller name
action - The action name
parameterValues - The parameter values
encoding - The encoding to use for parameters
fragment - The URL fragment to be appended to the URL following a #
Returns:
The created URL for the given arguments

match

public UrlMappingInfo match(int responseCode)

setExceptionType

public void setExceptionType(Class exClass)

getExceptionType

public Class getExceptionType()


Copyright (c) 2005-2009 The Grails project