当前位置: 首页>>代码示例>>Java>>正文


Java Policy类代码示例

本文整理汇总了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;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:36,代码来源:BindingPolicyManager.java

示例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;
}
 
开发者ID:scarcher2,项目名称:stripes,代码行数:38,代码来源:BindingPolicyManager.java

示例3: getDefaultPolicy

import net.sourceforge.stripes.action.StrictBinding.Policy; //导入依赖的package包/类
/**
 * Get the default policy.
 * 
 * @return the policy
 */
public Policy getDefaultPolicy() {
    return defaultPolicy;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:9,代码来源:BindingPolicyManager.java


注:本文中的net.sourceforge.stripes.action.StrictBinding.Policy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。