1 package com.atlassian.xwork.interceptors;
2
3 import com.opensymphony.xwork.interceptor.Interceptor;
4 import com.opensymphony.xwork.ActionInvocation;
5 import com.opensymphony.xwork.Action;
6 import com.opensymphony.xwork.ValidationAware;
7 import com.opensymphony.xwork.Validateable;
8
9
10
11
12
13
14 public class SimpleValidationInterceptor implements Interceptor
15 {
16 public String intercept(ActionInvocation invocation) throws Exception
17 {
18 Action action = invocation.getAction();
19 if (action instanceof ValidationAware && action instanceof Validateable)
20 {
21 ((Validateable)action).validate();
22 if (((ValidationAware)action).hasErrors())
23 {
24 return Action.INPUT;
25 }
26 }
27
28 return invocation.invoke();
29 }
30
31
32 public void destroy()
33 {
34 }
35
36 public void init()
37 {
38 }
39 }