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

java.lang.Object
  extended by org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingsHolder
All Implemented Interfaces:
UrlMappingsHolder

public class DefaultUrlMappingsHolder
extends Object
implements UrlMappingsHolder

The default implementation of the UrlMappingsHolder interface that takes a list of mappings and then sorts them according to their precdence rules as defined in the implementation of Comparable

Since:
0.4

Created: Mar 6, 2007 Time: 8:21:00 AM

Author:
Graeme Rocher
See Also:
UrlMapping, Comparable

Nested Class Summary
(package private)  class DefaultUrlMappingsHolder.UrlMappingKey
          A class used as a key to lookup a UrlMapping based on controller, action and parameter names
 
Field Summary
 
Fields inherited from interface org.codehaus.groovy.grails.web.mapping.UrlMappingsHolder
BEAN_ID
 
Constructor Summary
DefaultUrlMappingsHolder(List mappings)
           
 
Method Summary
 UrlCreator getReverseMapping(String controller, String action, Map params)
          Retrieves the best guess of a URI for the given controller, action and parameters
 UrlMapping[] getUrlMappings()
          Retrieves the held UrlMapping instances as an array
 UrlMappingInfo match(String uri)
          Match and return the first UrlMappingInfo instance possible
 UrlMappingInfo[] matchAll(String uri)
          Matches all possible UrlMappingInfo instances to the given URI and returns them all
 UrlMappingInfo[] matchAll(String uri, String httpMethod)
          Match all possible UrlMappingInfo instances to the given URI and HTTP method
 UrlMappingInfo matchStatusCode(int responseCode)
          Match and return the first UrlMappingInfo instance possible
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultUrlMappingsHolder

public DefaultUrlMappingsHolder(List mappings)
Method Detail

getUrlMappings

public UrlMapping[] getUrlMappings()
Description copied from interface: UrlMappingsHolder
Retrieves the held UrlMapping instances as an array

Specified by:
getUrlMappings in interface UrlMappingsHolder
Returns:
An array of UrlMapping instances

getReverseMapping

public UrlCreator getReverseMapping(String controller,
                                    String action,
                                    Map params)
Description copied from interface: UrlMappingsHolder
Retrieves the best guess of a URI for the given controller, action and parameters

Specified by:
getReverseMapping in interface UrlMappingsHolder
Parameters:
controller - The name of the controller
action - The name of the action or null
params - The parameters or null
Returns:
A URI for the given arguments
See Also:
UrlMappingsHolder.getReverseMapping(String, String, java.util.Map)

match

public UrlMappingInfo match(String uri)
Description copied from interface: UrlMappingsHolder
Match and return the first UrlMappingInfo instance possible

Specified by:
match in interface UrlMappingsHolder
Parameters:
uri - The URI to match
Returns:
A UrlMappingInfo or null
See Also:
UrlMappingsHolder.match(String)

matchAll

public UrlMappingInfo[] matchAll(String uri)
Description copied from interface: UrlMappingsHolder
Matches all possible UrlMappingInfo instances to the given URI and returns them all

Specified by:
matchAll in interface UrlMappingsHolder
Parameters:
uri - The URI to match
Returns:
An array of 0 or many UrlMappngInfo instances

matchAll

public UrlMappingInfo[] matchAll(String uri,
                                 String httpMethod)
Description copied from interface: UrlMappingsHolder
Match all possible UrlMappingInfo instances to the given URI and HTTP method

Specified by:
matchAll in interface UrlMappingsHolder
Parameters:
uri - The URI to match
httpMethod - The HTTP method (GET,POST,PUT,DELETE etc.)
Returns:
An array of 0 or many UrlMappingInfo instances

matchStatusCode

public UrlMappingInfo matchStatusCode(int responseCode)
Description copied from interface: UrlMappingsHolder
Match and return the first UrlMappingInfo instance possible

Specified by:
matchStatusCode in interface UrlMappingsHolder
Parameters:
responseCode - The responseCode to match
Returns:
A UrlMappingInfo or null

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2005-2006 The Grails project