public abstract class ControllerPlugin extends Object implements Plugin
allows plugin different controller annotations framework, e.g. JAX-RS
Modifier and Type | Class and Description |
---|---|
static class |
ControllerPlugin.Manager |
static class |
ControllerPlugin.PathAnnotationSpec |
Plugin.InfoRepo
Constructor and Description |
---|
ControllerPlugin() |
Modifier and Type | Method and Description |
---|---|
org.osgl.Lang.Func2<org.osgl.mvc.result.Result,ActionContext,org.osgl.mvc.result.Result> |
afterHandler(Class<?> controllerClass,
Method actionMethod)
|
protected abstract Map<Class<? extends Annotation>,org.osgl.http.H.Method> |
annotationMethodLookup() |
org.osgl.Lang.Function<ActionContext,org.osgl.mvc.result.Result> |
beforeHandler(Class<?> controllerClass,
Method actionMethod)
Returns function that takes
ActionContext as parameter and returns a Result . |
protected abstract boolean |
noDefaultPath() |
void |
register() |
protected abstract ControllerPlugin.PathAnnotationSpec |
urlContextAnnotation() |
protected abstract Map<Class<? extends Annotation>,org.osgl.http.H.Method> annotationMethodLookup()
protected abstract ControllerPlugin.PathAnnotationSpec urlContextAnnotation()
protected abstract boolean noDefaultPath()
public org.osgl.Lang.Function<ActionContext,org.osgl.mvc.result.Result> beforeHandler(Class<?> controllerClass, Method actionMethod)
Returns function that takes ActionContext
as parameter and returns a Result
. If a non-null result is returned, then it will by pass the ActFramework handling process and return directly, in which case the plugin literally hijack the ActFramework handling process.
The plugin might also do some changes to ActionContext
and return null
value in which case ActFramework normal handling process still happens.
controllerClass
- the controller classactionMethod
- the action methodpublic org.osgl.Lang.Func2<org.osgl.mvc.result.Result,ActionContext,org.osgl.mvc.result.Result> afterHandler(Class<?> controllerClass, Method actionMethod)
Returns function that takes Result
and ActionContext
as parameter and returns a Result
. This function is called after ActFramework’s processing has finished.
The afterHandler allows plugin to inject logic to further process the returned result or do some updates to ActionContext
for example to change the response content type etc.
The afterHandler shall always returns a result even if there is nothing to do with it, it must return the result passed in.
controllerClass
- the controller classactionMethod
- the action methodCopyright © 2014–2018 ActFramework. All rights reserved.