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

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

public class ResponseCodeUrlMapping
extends Object
implements UrlMapping

A Url mapping for http response codes

Since:
1.0-RC1
Author:
mike

Field Summary
 
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)
           
 
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 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
 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 setParameterValues(Map parameterValues)
          Sets any parameter values that should be populated into the request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseCodeUrlMapping

public ResponseCodeUrlMapping(UrlMappingData urlData,
                              Object controllerName,
                              Object actionName,
                              Object viewName,
                              ConstrainedProperty[] constraints)
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
Returns:
An array containing the ConstrainedProperty objects of this URLMapping

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
Returns:
The controller name as a Closure or String

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
Returns:
The action name as a Closure or String

getViewName

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

Specified by:
getViewName in interface UrlMapping
Returns:
The view name

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

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)


Copyright (c) 2005-2006 The Grails project