本文整理汇总了Java中net.sourceforge.stripes.action.StrictBinding.Policy类的典型用法代码示例。如果您正苦于以下问题:Java Policy类的具体用法?Java Policy怎么用?Java Policy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Policy类属于net.sourceforge.stripes.action.StrictBinding包,在下文中一共展示了Policy类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBindingAllowed
import net.sourceforge.stripes.action.StrictBinding.Policy; //导入依赖的package包/类
/**
* Indicates if binding is allowed for the given expression.
*
* @param eval a property expression that has been evaluated against an {@link ActionBean}
* @return true if binding is allowed; false if not
*/
public boolean isBindingAllowed(PropertyExpressionEvaluation eval) {
// Ensure no-one is trying to bind into a protected type
if (usesIllegalNodeValueType(eval)) {
return false;
}
// check parameter name against access lists
String paramName = new ParameterName(eval.getExpression().getSource()).getStrippedName();
boolean deny = denyPattern != null && denyPattern.matcher(paramName).matches();
boolean allow = (allowPattern != null && allowPattern.matcher(paramName).matches())
|| (validatePattern != null && validatePattern.matcher(paramName).matches());
/*
* if path appears on neither or both lists ( i.e. !(allow ^ deny) ) and default policy is
* to deny access, then fail
*/
if (defaultPolicy == Policy.DENY && !(allow ^ deny))
return false;
/*
* regardless of default policy, if it's in the deny list but not in the allow list, then
* fail
*/
if (!allow && deny)
return false;
// any other conditions pass the test
return true;
}
示例2: isBindingAllowed
import net.sourceforge.stripes.action.StrictBinding.Policy; //导入依赖的package包/类
/**
* Indicates if binding is allowed for the given expression.
*
* @param eval a property expression that has been evaluated against an {@link ActionBean}
* @return true if binding is allowed; false if not
*/
public boolean isBindingAllowed(PropertyExpressionEvaluation eval) {
// Ensure no-one is trying to bind into the ActionBeanContext!!
Type firstNodeType = eval.getRootNode().getValueType();
if (firstNodeType instanceof Class<?>
&& ActionBeanContext.class.isAssignableFrom((Class<?>) firstNodeType)) {
return false;
}
// check parameter name against access lists
String paramName = new ParameterName(eval.getExpression().getSource()).getStrippedName();
boolean deny = denyPattern != null && denyPattern.matcher(paramName).matches();
boolean allow = (allowPattern != null && allowPattern.matcher(paramName).matches())
|| (validatePattern != null && validatePattern.matcher(paramName).matches());
/*
* if path appears on neither or both lists ( i.e. !(allow ^ deny) ) and default policy is
* to deny access, then fail
*/
if (defaultPolicy == Policy.DENY && !(allow ^ deny))
return false;
/*
* regardless of default policy, if it's in the deny list but not in the allow list, then
* fail
*/
if (!allow && deny)
return false;
// any other conditions pass the test
return true;
}
示例3: getDefaultPolicy
import net.sourceforge.stripes.action.StrictBinding.Policy; //导入依赖的package包/类
/**
* Get the default policy.
*
* @return the policy
*/
public Policy getDefaultPolicy() {
return defaultPolicy;
}