/** * Configure defaults. */ protected void configureDefaults() { final ActionConfigManager actionConfigManager = madvocContainer.lookupComponent(ActionConfigManager.class); actionConfigManager.registerAnnotation(Action.class); actionConfigManager.registerAnnotation(RestAction.class); }
@Override public void ready() { if (actionsManager.isAsyncModeOn()) { asyncActionExecutor.start(); } }
/** * Registers component using its {@link #resolveBaseComponentName(Class) base name}. * Previously defined component will be removed. * * @see #registerComponentInstance(Object) */ public void registerComponent(final Class component) { String name = resolveBaseComponentName(component); registerComponent(name, component); }
private InterceptorsManager createInterceptorManager() { PetiteContainer madpc = new PetiteContainer(); madpc.addSelf("madpc"); madpc.addBean("madvocEncoding", new MadvocEncoding()); InterceptorsManager im = new InterceptorsManager(); im.contextInjectorComponent = new ContextInjectorComponent(); im.contextInjectorComponent.madvocController = new MadvocController(); im.contextInjectorComponent.madvocController.servletContextProvider = new ServletContextProvider(null); im.contextInjectorComponent.scopeDataInspector = new ScopeDataInspector(); im.contextInjectorComponent.scopeResolver = new ScopeResolver(); im.contextInjectorComponent.scopeResolver.madpc = madpc; return im; }
/** * Registers an action result handler and returns created {@link jodd.madvoc.result.ActionResult} if * result with same type doesn't exist. Otherwise, returns existing result and created one will be ignored. */ public ActionResult register(final Class<? extends ActionResult> resultClass) { return register(createResult(resultClass)); }
/** * Registers action with provided action class and method name. * @see #registerAction(Class, Method, ActionDefinition) */ public ActionRuntime registerAction(final Class actionClass, final String actionMethodName, final ActionDefinition actionDefinition) { Method actionMethod = resolveActionMethod(actionClass, actionMethodName); return registerAction(actionClass, actionMethod, actionDefinition); }
protected ActionInterceptor[] parseActionInterceptors(final Class<?> actionClass, final Method actionMethod, final ActionConfig actionConfig) { Class<? extends ActionInterceptor>[] interceptorClasses = readActionInterceptors(actionMethod); if (interceptorClasses == null) { interceptorClasses = readActionInterceptors(actionClass); } if (interceptorClasses == null) { interceptorClasses = actionConfig.getInterceptors(); } return interceptorsManager.resolveAll(interceptorClasses); }
/** * Configures an interceptor. */ @SuppressWarnings("unchecked") public <T extends ActionInterceptor> MadvocRouter interceptor(final Class<T> actionInterceptorClass) { interceptorsManager.resolve(actionInterceptorClass); return this; }
/** * Sets root package to package of given class. */ public void addRootPackageOf(final Class actionClass) { addRootPackageOf(actionClass, StringPool.EMPTY); }
public WebApp() { madvocContainer = new MadvocContainer(); madvocContainer.registerComponentInstance(madvocContainer); }
/** * Adds root package with no additional mapping. */ public void addRootPackage(final String rootPackage) { addRootPackage(rootPackage, StringPool.EMPTY); }
protected ActionFilter[] parseActionFilters(final Class<?> actionClass, final Method actionMethod, final ActionConfig actionConfig) { Class<? extends ActionFilter>[] filterClasses = readActionFilters(actionMethod); if (filterClasses == null) { filterClasses = readActionFilters(actionClass); } if (filterClasses == null) { filterClasses = actionConfig.getFilters(); } return filtersManager.resolveAll(filterClasses); }
/** * Returns all interceptors. */ public Set<ActionInterceptor> getAllInterceptors() { return super.getAll(); }
/** * Initializes action result. */ protected void initializeResult(final ActionResult result) { contextInjectorComponent.injectContext(result); }
/** * Lookups the scope instance of given scope annotation. * If instance does not exist, it will be created, cached and returned. */ @SuppressWarnings("unchecked") public <S extends MadvocScope> S defaultOrScopeType(final Class<S> scopeClass) { if (scopeClass == null) { return (S) getOrInitScope(RequestScope.class); } return (S) getOrInitScope(scopeClass); }
/** * Returns action filter instance for further configuration. */ @SuppressWarnings("unchecked") public <T extends ActionFilter> MadvocRouter filter(final Class<T> actionFilterClass) { filtersManager.resolve(actionFilterClass); return this; }
/** * Returns application context set during the initialization. */ public ServletContext getApplicationContext() { return servletContextProvider.get(); }
/** * Detects {@link jodd.madvoc.meta.ActionAnnotationValues}. Returns {@code null} if annotation does not exist. */ protected ActionAnnotationValues detectActionAnnotationValues(final Method actionMethod) { return actionConfigManager.readAnnotationValue(actionMethod); }
public <T> void registerComponent(final Class<T> component, final Consumer<T> consumer) { String name = resolveBaseComponentName(component); registerComponent(name, component, consumer); }
/** * Returns all filters. */ public Set<ActionFilter> getAllFilters() { return super.getAll(); }