net.sourceforge.stripes.exception
Class UrlBindingConflictException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by net.sourceforge.stripes.exception.StripesRuntimeException
                  extended by net.sourceforge.stripes.exception.UrlBindingConflictException
All Implemented Interfaces:
Serializable

public class UrlBindingConflictException
extends StripesRuntimeException

This exception indicates that a URL does not contain enough information to map it to a single ActionBean class. In some cases, a URL may match more than one URL binding.

For example, suppose you have two ActionBeans with the URL bindings /foo/{param}/bar and /foo/{param}/blah. The paths /foo and /foo/X -- while legal, since any number of parameters or literals may be omitted from the end of a clean URL -- match both of the URL bindings. Since Stripes cannot determine from the URL the ActionBean to which to dispatch the request, it throws this exception to indicate the conflict.

Since:
Stripes 1.5.1
Author:
Ben Gunter
See Also:
Serialized Form

Constructor Summary
UrlBindingConflictException(Class<? extends ActionBean> targetClass, String path, Collection<String> matches)
          New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.
UrlBindingConflictException(String message, Class<? extends ActionBean> targetClass, String path, Collection<String> matches)
          New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.
UrlBindingConflictException(String path, Collection<String> matches)
          New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.
UrlBindingConflictException(String message, String path, Collection<String> matches)
          New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.
 
Method Summary
 Collection<String> getMatches()
          Get all the URL bindings on existing ActionBeans that match the path
protected static String getMessage(Class<? extends ActionBean> targetClass, String path, Collection<String> matches)
          Generate the message to pass to the superclass constructor
 String getPath()
          Get the path that failed to map to a single ActionBean
 Class<? extends ActionBean> getTargetClass()
          Get the ActionBean class for which a URL was being generated when this exception was thrown.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UrlBindingConflictException

public UrlBindingConflictException(String message,
                                   Class<? extends ActionBean> targetClass,
                                   String path,
                                   Collection<String> matches)
New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.

Parameters:
message - An informative message about what went wrong
targetClass - The class for which a URL could not be generated.
path - The offending path
matches - A collection of all the potentially matching URL bindings

UrlBindingConflictException

public UrlBindingConflictException(Class<? extends ActionBean> targetClass,
                                   String path,
                                   Collection<String> matches)
New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.

Parameters:
targetClass - The class for which a URL could not be generated.
path - The offending path
matches - A collection of all the potentially matching URL bindings

UrlBindingConflictException

public UrlBindingConflictException(String message,
                                   String path,
                                   Collection<String> matches)
New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.

Parameters:
message - An informative message about what went wrong
path - The offending path
matches - A collection of all the potentially matching URL bindings

UrlBindingConflictException

public UrlBindingConflictException(String path,
                                   Collection<String> matches)
New exception indicating that the path does not map to a single ActionBean because it potentially matches all the URL bindings in the matches collection.

Parameters:
path - The offending path
matches - A collection of all the potentially matching URL bindings
Method Detail

getMessage

protected static String getMessage(Class<? extends ActionBean> targetClass,
                                   String path,
                                   Collection<String> matches)
Generate the message to pass to the superclass constructor


getPath

public String getPath()
Get the path that failed to map to a single ActionBean


getMatches

public Collection<String> getMatches()
Get all the URL bindings on existing ActionBeans that match the path


getTargetClass

public Class<? extends ActionBean> getTargetClass()
Get the ActionBean class for which a URL was being generated when this exception was thrown. If the exception occurred while dispatching a request, then this property will be null since the path cannot be associated with an ActionBean class. However, if it is thrown while generating a URL that is intended to point to an ActionBean, then this property will indicate the class that was being targeted.



? Copyright 2005-2006, Stripes Development Team.