|
TagLib documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.alweb.doff.mapping.Mapping
org.alweb.doff.mapping.ActionMapping
public final class ActionMapping
Represents a mapping of an action. An action is a Controller method
annotated by Action.
Action| Constructor Summary | |
|---|---|
ActionMapping(ControllerMapping controllerMapping,
Method method)
Creates a new ActionMapping instance from its controller mapping and its method. |
|
| Method Summary | |
|---|---|
void |
checkConflicts(ActionMapping action)
Checks if this ActionMapping object conflicts with specified action. |
void |
checkConflicts(Collection<? extends ActionMapping> actions)
Checks if one of specified actions is in conflict with this ActionMapping object. |
boolean |
containsPathPattern()
Determines if this mapping contains at least one path pattern. |
boolean |
excludes(Class<? extends Filter> filterClass)
Determines if this action mapping excludes specified filter class. |
ControllerMapping |
getControllerMapping()
Returns the controller mapping specified at the constructor. |
String |
getFullPath(Object... extraInfos)
Returns the full path of this ActionMapping including the controller path. |
Method |
getHttpMethod()
Returns the Method used by this ActionMapping object. |
Method |
getMethod()
Returns the method specified at the contructor. |
String |
getMethodName()
A convenience helper to retrieve the name of the method. |
String |
getName()
Returns the name of this action mapping. |
Collection<ParameterMapping> |
getParameters()
Returns all mapped parameters of this action mapping. |
Object[] |
getParametersValues(Controller controller)
Returns all parameters values as an object array. |
String |
getPath()
Returns the path specified by Action.path() annotation property
or null if the Action identified by this ActionMapping is
the controller's index. |
Parameter |
getPathParam(String path,
int index)
Provides a way to retrieve a path param identified thanks to ${string}, ${int} or ${all}
patterns. |
int |
getPathPatternCount()
Returns the count of path pattern of this ActionMapping object path. |
String |
getURL(Object... extraInfos)
Returns the relative URL of this ActionMapping object. |
String |
getViewPath()
Returns the location of this ActionMapping view path. |
boolean |
is(Class<? extends Controller> controllerClass,
String methodName)
Determines if this ActionMapping object is the action identified by specified Controller class and method name. |
boolean |
isIndex()
Determines if the action represented by this mapping is the index of its controller. |
boolean |
matches(ServletParameters parameters)
Determines if this ActionMapping object matches specified servlet parameters. |
String |
toString()
Provides a string representation of this ActionMapping object. |
| Methods inherited from class org.alweb.doff.mapping.Mapping |
|---|
getAssociatedObject |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ActionMapping(ControllerMapping controllerMapping,
Method method)
MappingException - if specified method hasn't the Action
annotation or if method is abstract or takes any undeclared
parameter or if the Action annotation's path contains only
spaces and/or slashes. A MappingException is also
thrown when parameters are malformed into Action
annotation or if parameter count isn't equals to method
parameters count.
NullPointerException - if one of specified parameters is
null.Action.path()| Method Detail |
|---|
public void checkConflicts(ActionMapping action)
action - The action to check if conflict exists.
MappingException - if Method of both action is the same and
if paths are in conflicts.public void checkConflicts(Collection<? extends ActionMapping> actions)
actions - The actions to check conflicts for.
MappingException - if there is at least one of specified action in
conflict with this ActionMapping object.checkConflicts(ActionMapping)public boolean containsPathPattern()
${string}, ${int} or
${all}.
public boolean excludes(Class<? extends Filter> filterClass)
Action.exclude() annotation attribute. If you want to exclude all
controller's actions of filter execution, add Exclude annotation
on you filter and add you controller into value array.
public ControllerMapping getControllerMapping()
ActionMapping(ControllerMapping, Method)public String getFullPath(Object... extraInfos)
null, the
variable pattern will be kept.
getPath(),
ControllerMapping.getPath()public Method getHttpMethod()
Method used by this ActionMapping object.
Action.method()public Method getMethod()
ActionMapping(ControllerMapping, Method),
Mapping.getAssociatedObject()public String getMethodName()
getMethod().getName()
getMethod(),
Method.getName()public String getName()
Returns the name of this action mapping. The name is the controller's name concatened to '#' char and then, the name of the method.
Example: MyController#myAction
getMethodName(),
ServiceMapping.getName()public Collection<ParameterMapping> getParameters()
Action.params()public Object[] getParametersValues(Controller controller)
Action.params(),
getParameters()public String getPath()
Action.path() annotation property
or null if the Action identified by this ActionMapping is
the controller's index.
Action.path(),
Action.index(),
isIndex()
public Parameter getPathParam(String path,
int index)
${string}, ${int} or ${all}
patterns. If this mapping doesn't match specified path, this method will
always returns a Parameter with null as parameter value.
path - The path info of current URL.index - The index of the param (starts at 0).getPath(),
matches(ServletParameters),
Action.path()public int getPathPatternCount()
${string}, ${int} or
${all} string.
containsPathPattern(),
getFullPath(Object[])public String getURL(Object... extraInfos)
extraInfos - The extra informations of the action path. First it is
path patterns. Each specified extra info will replace
${string}, ${int} or
${all} patterns in the action path. Then, if
you specify more extra info than path patterns, your
parameters will be added to the query string, one by one (null
parameters will not be added).getFullPath(Object[])public String getViewPath()
Returns the location of this ActionMapping view path. The path is obtained from the current action method name preceded by the controller's name. The returned path always starts with a slash but never ends with a slash. All uppercase letters are preceded by an underscore and converted to lowercase. The name of the controller represents the directory, the name of the action method, the file.
Example: for an action with method list obtained in controller
UsersAccounts. The path of the view is:
users_accounts/list.
PathUtilities.convert(String),
Class.getSimpleName(),
Method.getName()
public boolean is(Class<? extends Controller> controllerClass,
String methodName)
Controller class and method name.
controllerClass - The class of the controller.methodName - The name of the action method.
true if this ActionMapping object is identified by
specified controller class and method name, false
otherwise.public boolean isIndex()
ActionMapping is always an index if method's name
is index.
Action.index()public boolean matches(ServletParameters parameters)
Determines if this ActionMapping object matches specified servlet
parameters. This method checks if the Method is the same as
specified one and checks the path. This method also uses
${string}, ${int} and ${all}
patterns. The specified path must contains controller's path.
This method also uses the case-sensitive property of the
associated controller mapping (ControllerMapping.isCaseSensitive()).
parameters - The parameters of the current request.
true if this mapping matches specified path,
false otherwise.ServletParameters.getPathInfo()public String toString()
toString in class MappinggetName()
|
TagLib documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||