public interface ActionResolver extends ConfigurableComponent
Resolvers are responsible for locating ActionBean instances that can handle the submitted request. Once an appropriate ActionBean has been identified the ActionResolver is also responsible for identifying the individual method on the ActionBean class that should handle this specific request.
Throughout this class two terms are used that refer to similar but not interchangeable
concepts. UrlBinding
refers to the exact URL to which a bean is bound, e.g.
/account/Profile.action
. Path
refers to the path segment of the requested
URL and is generally composed of the URL binding and possibly some additional information,
e.g. /account/Profile.action/edit
. In general the methods in this class are capable
of taking in a path
and extracting the UrlBinding
from it.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
RESOLVED_ACTION
Key that is to be used by ActionResolvers to store, as a request attribute, the
action that was resolved in the current request.
|
Modifier and Type | Method and Description |
---|---|
ActionBean |
getActionBean(ActionBeanContext context)
Resolves the Class, implementing ActionBean, that should be used to handle the request.
|
ActionBean |
getActionBean(ActionBeanContext context,
java.lang.String path)
Returns the ActionBean class that responds to the path provided.
|
java.util.Collection<java.lang.Class<? extends ActionBean>> |
getActionBeanClasses()
Get all the classes implementing
ActionBean that are recognized by this
ActionResolver . |
java.lang.Class<? extends ActionBean> |
getActionBeanType(java.lang.String path)
Fetches the Class representing the type of ActionBean that has been bound to
the URL contained within the path supplied.
|
java.lang.reflect.Method |
getDefaultHandler(java.lang.Class<? extends ActionBean> bean)
Locates and returns the default handler method that should be invoked when no specific
event is named.
|
java.lang.String |
getEventName(java.lang.Class<? extends ActionBean> bean,
ActionBeanContext context)
Determines the name of the event fired by the front end.
|
java.lang.String |
getHandledEvent(java.lang.reflect.Method handler)
Returns the name of the event to which a given handler method responds.
|
java.lang.reflect.Method |
getHandler(java.lang.Class<? extends ActionBean> bean,
java.lang.String eventName)
Resolves the Method which handles the named event.
|
java.lang.String |
getUrlBinding(java.lang.Class<? extends ActionBean> clazz)
Takes a class that implements ActionBean and returns the URL binding of that class.
|
java.lang.String |
getUrlBindingFromPath(java.lang.String path)
Returns the URL binding that is a substring of the path provided.
|
init
static final java.lang.String RESOLVED_ACTION
java.lang.String getUrlBindingFromPath(java.lang.String path)
/user/Profile.action
, invoking
getUrlBindingFromPath("/user/Profile.action/view"
should return
"/user/Profile.action"
.path
- the path being used to access an ActionBean, either in a form or link tag,
or in a request that is hitting the DispatcherServlet.ActionBean getActionBean(ActionBeanContext context) throws StripesServletException
context
- the ActionBeanContext for the current requestStripesServletException
- thrown if a ActionBean cannot be resolved for any reasonActionBean getActionBean(ActionBeanContext context, java.lang.String path) throws StripesServletException
context
- the current action bean contextpath
- the path segment of the request (or link or action)StripesServletException
- if a matching ActionBean cannot be foundjava.lang.Class<? extends ActionBean> getActionBeanType(java.lang.String path)
path
- the path segment of a request url or form action or linkjava.lang.String getUrlBinding(java.lang.Class<? extends ActionBean> clazz)
clazz
- a class that implements ActionBeanjava.lang.String getEventName(java.lang.Class<? extends ActionBean> bean, ActionBeanContext context)
bean
- the ActionBean type that has been bound to the requestcontext
- the ActionBeanContext for the current requestjava.lang.reflect.Method getHandler(java.lang.Class<? extends ActionBean> bean, java.lang.String eventName) throws StripesServletException
bean
- the ActionBean type that has been bound to the requesteventName
- the named event being handled by the ActionBeanStripesServletException
- thrown if a method cannot be resolved for any reason,
including but not limited to, when a Method does not exist that handles the event.java.lang.reflect.Method getDefaultHandler(java.lang.Class<? extends ActionBean> bean) throws StripesServletException
bean
- the ActionBean type that has been bound to the requestStripesServletException
- thrown if a default handler method cannot be found.java.lang.String getHandledEvent(java.lang.reflect.Method handler) throws StripesServletException
handler
- the handler method who's event name to findStripesServletException
java.util.Collection<java.lang.Class<? extends ActionBean>> getActionBeanClasses()
ActionBean
that are recognized by this
ActionResolver
. This method must return the full set of ActionBean
classes
after the call to init().? Copyright 2005-2006, Stripes Development Team.