JODD行动拦截器
我无法理解拦截器应该如何工作,因为我有一些带有@Intercepted注释的MadVoAction,但拦截器堆栈似乎没有被访问JODD行动拦截器,jodd,Jodd,我无法理解拦截器应该如何工作,因为我有一些带有@Intercepted注释的MadVoAction,但拦截器堆栈似乎没有被访问 @MadvocAction("index") public class IndexAction extends AppAction { @PetiteInject private TemperatureService temperatureService; @Action @InterceptedBy(AppInterceptorStack.class) publi
@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.props:
madvocConfig.defaultInterceptors=ro.videanuadrian.smartHome.web.interceptors.AppInterceptorStack
madvocConfig.fileUploadFactory.maxFileSize=-1
在您的回答之后,我已经对madvoconfig.defaultInterceptors进行了评论,但结果是一样的。您在这里所做的一切似乎都很好。然而,注释可能不起作用有一个原因:您是否可能使用
madvoc routes.txt
如前所述,定义操作和拦截器的另一种方法是将此配置文件与路由一起使用。如果启用此选项,您可能会忽略注释
请检查这是否属实,如果属实:
- 在路由文件中定义拦截器
- 或删除仅用于注释的管线和go配置
我做了一个模拟你所做的一切的实验。我的接受者被叫了。请您检查一下好吗?@VideanuAdrian我刚刚在github上做了一个例子。从你写的来看一切都很好。请你检查一下我的例子好吗?请你标出答案好吗?
madvocConfig.defaultInterceptors=ro.videanuadrian.smartHome.web.interceptors.AppInterceptorStack
madvocConfig.fileUploadFactory.maxFileSize=-1