|
Struts example source code file (AnnotationParameterFilterIntereptor.java)
The Struts AnnotationParameterFilterIntereptor.java source codepackage com.opensymphony.xwork2.interceptor.annotations; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; import com.opensymphony.xwork2.interceptor.Interceptor; import com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor; import com.opensymphony.xwork2.interceptor.ParametersInterceptor; import com.opensymphony.xwork2.util.AnnotationUtils; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; /** * Annotation based version of {@link ParameterFilterInterceptor}. * <p/> * This {@link Interceptor} must be placed in the stack before the {@link ParametersInterceptor} * When a parameter matches a field that is marked {@link Blocked} then it is removed from * the parameter map. * <p/> * If an {@link Action} class is marked with {@link BlockByDefault} then all parameters are * removed unless a field on the Action exists and is marked with {@link Allowed} * * @author martin.gilday */ public class AnnotationParameterFilterIntereptor extends AbstractInterceptor { /* (non-Javadoc) * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation) */ @Override public String intercept(ActionInvocation invocation) throws Exception { final Object action = invocation.getAction(); Map<String, Object> parameters = invocation.getInvocationContext().getParameters(); Object model = invocation.getStack().peek(); if (model == action) { model = null; } boolean blockByDefault = action.getClass().isAnnotationPresent(BlockByDefault.class); List<Field> annotatedFields = new ArrayList Other Struts examples (source code examples)Here is a short list of links related to this Struts AnnotationParameterFilterIntereptor.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.