Package org.javalite.activeweb
Class RouteUtil
java.lang.Object
org.javalite.activeweb.RouteUtil
This class exists to aggregate some common functions that are used by ActiveWeb as well as the Ope API plugin.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNamedMethods(Class<? extends AppController> controllerClass, String actionMethodName)
Gets methods matching an action name.static boolean
hasAction(Class<? extends AppController> controllerClass, String actionName, HttpMethod httpMethod)
Finds if a controller has an action method with a given HTTP method.static boolean
Tests if a method is callable in an HTTP request.
-
Field Details
-
PRIMITIVES
-
-
Constructor Details
-
RouteUtil
public RouteUtil()
-
-
Method Details
-
getNamedMethods
public static List<Method> getNamedMethods(Class<? extends AppController> controllerClass, String actionMethodName)Gets methods matching an action name. Excludes: methods of superclasses from JavaLite and all non-public methods- Returns:
- all methods matching a method name.
-
isAction
Tests if a method is callable in an HTTP request. Rules: 1. Modifier (must be public) 2. Return value (must be void) 3. Parameters (count must be 1 or 0), 4. Cannot be static 5. Cannot be abstract -
hasAction
public static boolean hasAction(Class<? extends AppController> controllerClass, String actionName, HttpMethod httpMethod) throws InvocationTargetException, InstantiationException, IllegalAccessExceptionFinds if a controller has an action method with a given HTTP method.- Parameters:
controllerClass
- controller classactionName
- name of an actionhttpMethod
- HttpMethod instance.- Returns:
- true if such an action exists, false if not.
- Throws:
InvocationTargetException
InstantiationException
IllegalAccessException
-