我不知道拦截器应该如何工作,因为我有一些带有 @Intercepted 注释的 MadvocAction,但似乎没有访问拦截器堆栈。
@MadvocAction("index")
public class IndexAction extends AppAction {
@PetiteInject
private TemperatureService temperatureService;
@Action
@InterceptedBy(AppInterceptorStack.class)
public void view() {
// body here ....
}
和拦截器堆栈:
package ro.videanuadrian.smartHome.web.interceptors;
import jodd.joy.madvoc.interceptor.DefaultInterceptorStack;
import jodd.madvoc.interceptor.ActionInterceptorStack;
import jodd.madvoc.interceptor.EchoInterceptor;
public class AppInterceptorStack extends ActionInterceptorStack {
public AppInterceptorStack() {
super(
AppAuthenticationInterceptor.class,
EchoInterceptor.class,
DefaultInterceptorStack.class
);
}
}
任何想法 ?
使用 madvoc 配置更新:所以这是在我的 web.xml 中:
<filter>
<filter-name>madvoc</filter-name>
<filter-class>jodd.madvoc.MadvocServletFilter</filter-class>
<init-param>
<param-name>madvoc.webapp</param-name>
<param-value>ro.videanuadrian.smartHome.config.SmartHomeWebApplication</param-value>
</init-param>
<init-param>
<param-name>madvoc.params</param-name>
<param-value>/madvoc.props</param-value>
</init-param>
</filter>
这就是我的 Madvoc it1s 的初始化方式:
public class SmartHomeWebApplication extends PetiteWebApplication {
final SmartHomeServiceCore serviceCore;
public SmartHomeWebApplication() {
serviceCore = new SmartHomeServiceCore();
serviceCore.start();
}
/**
* Adds configurator to Madvoc container and invokes configuration.
*/
@Override
public void configure(MadvocConfigurator configurator) {
if (configurator instanceof AutomagicMadvocConfigurator){
AutomagicMadvocConfigurator amc = (AutomagicMadvocConfigurator) configurator;
amc.setExcludeAllEntries(true);
amc.setIncludedEntries("ro.videanuadrian.*");
registerComponent(amc);
amc.configure();
}
}
还有 madvoc.props:
madvocConfig.defaultInterceptors=ro.videanuadrian.smartHome.web.interceptors.AppInterceptorStack
madvocConfig.fileUploadFactory.maxFileSize=-1
在你的回答之后,我发表了评论madvocConfig.defaultInterceptors
,但结果是一样的。