Package org.actioncontroller
Interface ApiControllerAction
-
- All Known Implementing Classes:
ApiControllerMethodAction
public interface ApiControllerActionThe core of the framework.ApiServletandApiHandlerfinds an action to perform based onmatches(org.actioncontroller.ApiControllerAction)andinvoke(org.actioncontroller.UserContext, org.actioncontroller.ApiHttpExchange)this action.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MethodgetAction()Returns the method that implements this actionObjectgetController()Returns the controller that this action belongs toStringgetHttpMethod()Returns the request HTTP Method used to match this actionStringgetMethodName()Pattern[]getParamRegexp()Returns an sparse array with the element of the path specification that are parameterizedStringgetPattern()Returns the request URL pattern used to match this actionString[]getPatternParts()Returns an array with each element of the path specificationvoidinvoke(UserContext userContext, ApiHttpExchange exchange)Invokes this action on the givenApiHttpExchangeby converting the exchange to method invocation arguments, invoking the method and converting the return value.booleanmatches(ApiControllerAction action)Returns true if the actions respond to the same routesbooleanmatchesRequiredParameters(ApiHttpExchange exchange)Returns true if the exchange has all the required query parameters specified in this action, or if there are no required query parameters in the actionbooleanrequiresParameter()Returns true if the action requires a request parameter, such as@Get("/test?error").
-
-
-
Method Detail
-
getPatternParts
String[] getPatternParts()
Returns an array with each element of the path specification
-
getParamRegexp
Pattern[] getParamRegexp()
Returns an sparse array with the element of the path specification that are parameterized
-
invoke
void invoke(UserContext userContext, ApiHttpExchange exchange) throws IOException
Invokes this action on the givenApiHttpExchangeby converting the exchange to method invocation arguments, invoking the method and converting the return value.- Throws:
IOException
-
getController
Object getController()
Returns the controller that this action belongs to
-
getAction
Method getAction()
Returns the method that implements this action
-
getPattern
String getPattern()
Returns the request URL pattern used to match this action
-
getHttpMethod
String getHttpMethod()
Returns the request HTTP Method used to match this action
-
matchesRequiredParameters
boolean matchesRequiredParameters(ApiHttpExchange exchange)
Returns true if the exchange has all the required query parameters specified in this action, or if there are no required query parameters in the action
-
requiresParameter
boolean requiresParameter()
Returns true if the action requires a request parameter, such as@Get("/test?error"). When more than one action returns true frommatches(org.actioncontroller.ApiControllerAction)and exactly one action returns true from requiresParameter, that action is invokes. Otherwise action-controller throws an exception
-
matches
boolean matches(ApiControllerAction action)
Returns true if the actions respond to the same routes
-
getMethodName
String getMethodName()
-
-