com.opensymphony.xwork2.interceptor
abstract public class: MethodFilterInterceptor [javadoc |
source]
java.lang.Object
com.opensymphony.xwork2.interceptor.AbstractInterceptor
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor
All Implemented Interfaces:
Interceptor
Direct Known Subclasses:
PrepareInterceptor, ParametersInterceptor, ValidationInterceptor, DefaultWorkflowInterceptor
MethodFilterInterceptor is an abstract
Interceptor
used as
a base class for interceptors that will filter execution based on method
names according to specified included/excluded method lists.
Settable parameters are as follows:
- excludeMethods - method names to be excluded from interceptor processing
- includeMethods - method names to be included in interceptor processing
NOTE: If method name are available in both includeMethods and
excludeMethods, it will be considered as an included method:
includeMethods takes precedence over excludeMethods.
Interceptors that extends this capability include:
- TokenInterceptor
- TokenSessionStoreInterceptor
- DefaultWorkflowInterceptor
- ValidationInterceptor
Field Summary |
---|
protected transient Logger | log | |
protected Set<String> | excludeMethods | |
protected Set<String> | includeMethods | |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from com.opensymphony.xwork2.interceptor.MethodFilterInterceptor Detail: |
protected boolean applyInterceptor(ActionInvocation invocation) {
String method = invocation.getProxy().getMethod();
// ValidationInterceptor
boolean applyMethod = MethodFilterInterceptorUtil.applyMethod(excludeMethods, includeMethods, method);
if (log.isDebugEnabled()) {
if (!applyMethod) {
log.debug("Skipping Interceptor... Method [" + method + "] found in exclude list.");
}
}
return applyMethod;
}
|
abstract protected String doIntercept(ActionInvocation invocation) throws Exception
Subclasses must override to implement the interceptor logic. |
public Set<String> getExcludeMethodsSet() {
return excludeMethods;
}
|
public Set<String> getIncludeMethodsSet() {
return includeMethods;
}
|
public String intercept(ActionInvocation invocation) throws Exception {
if (applyInterceptor(invocation)) {
return doIntercept(invocation);
}
return invocation.invoke();
}
|
public void setExcludeMethods(String excludeMethods) {
this.excludeMethods = TextParseUtil.commaDelimitedStringToSet(excludeMethods);
}
|
public void setIncludeMethods(String includeMethods) {
this.includeMethods = TextParseUtil.commaDelimitedStringToSet(includeMethods);
}
|