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


Java Control类代码示例

本文整理汇总了Java中javax.naming.ldap.Control的典型用法代码示例。如果您正苦于以下问题:Java Control类的具体用法?Java Control怎么用?Java Control使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Control类属于javax.naming.ldap包,在下文中一共展示了Control类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareNextPage

import javax.naming.ldap.Control; //导入依赖的package包/类
private boolean prepareNextPage(LdapContext ldapContext) throws Exception {
    Control[] responseControls = ldapContext.getResponseControls();

    byte[] cookie = null;
    if (responseControls != null) {
        for (Control responseControl : responseControls) {
            if (responseControl instanceof PagedResultsResponseControl) {
                PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControl;
                cookie = prrc.getCookie();
            }
        }
    }

    if (cookie == null) {
        return false;
    } else {
        ldapContext.setRequestControls(new Control[]{new PagedResultsControl(pageSize, cookie, Control.CRITICAL)});
        return true;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:LdapProducer.java

示例2: DigestClientId

import javax.naming.ldap.Control; //导入依赖的package包/类
DigestClientId(int version, String hostname, int port,
    String protocol, Control[] bindCtls, OutputStream trace,
    String socketFactory, String username,
    Object passwd, Hashtable<?,?> env) {

    super(version, hostname, port, protocol, bindCtls, trace,
        socketFactory, username, passwd);

    if (env == null) {
        propvals = null;
    } else {
        // Could be smarter and apply default values for props
        // but for now, we just record and check exact matches
        propvals = new String[SASL_PROPS.length];
        for (int i = 0; i < SASL_PROPS.length; i++) {
            propvals[i] = (String) env.get(SASL_PROPS[i]);
            if (propvals[i] != null) {
                pHash = pHash * 31 + propvals[i].hashCode();
            }
        }
    }
    myHash = super.hashCode() + pHash;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:DigestClientId.java

示例3: SimpleClientId

import javax.naming.ldap.Control; //导入依赖的package包/类
SimpleClientId(int version, String hostname, int port,
    String protocol, Control[] bindCtls, OutputStream trace,
    String socketFactory, String username, Object passwd) {

    super(version, hostname, port, protocol, bindCtls, trace,
            socketFactory);

    this.username = username;
    if (passwd == null) {
        this.passwd = null;
    } else if (passwd instanceof String) {
        this.passwd = passwd;
    } else if (passwd instanceof byte[]) {
        this.passwd = ((byte[])passwd).clone();
    } else if (passwd instanceof char[]) {
        this.passwd = ((char[])passwd).clone();
    } else {
        this.passwd = passwd;
    }

    myHash = super.hashCode()
        + (username != null ? username.hashCode() : 0)
        + (passwd != null ? passwd.hashCode() : 0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:SimpleClientId.java

示例4: UnsolicitedResponseImpl

import javax.naming.ldap.Control; //导入依赖的package包/类
UnsolicitedResponseImpl(String oid, byte[] berVal, Vector<Vector<String>> ref,
    int status, String msg, String matchedDN, Control[] controls) {
    this.oid = oid;
    this.extensionValue = berVal;

    if (ref != null && ref.size() > 0) {
        int len = ref.size();
        referrals = new String[len];
        for (int i = 0; i < len; i++) {
            // ref is a list of single-String Vectors
            referrals[i] = ref.elementAt(i).elementAt(0);
        }
    }
    exception = LdapCtx.mapErrorCode(status, msg);
    // matchedDN ignored for now; could be used to set resolvedName
    // exception.setResolvedName(new CompositeName().add(matchedDN));

    this.controls = controls;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:UnsolicitedResponseImpl.java

示例5: equalsControls

import javax.naming.ldap.Control; //导入依赖的package包/类
private static boolean equalsControls(Control[] a, Control[] b) {
    if (a == b) {
        return true;  // both null or same
    }
    if (a == null || b == null) {
        return false; // one is non-null
    }
    if (a.length != b.length) {
        return false;
    }

    for (int i = 0; i < a.length; i++) {
        if (!a[i].getID().equals(b[i].getID())
            || a[i].isCritical() != b[i].isCritical()
            || !Arrays.equals(a[i].getEncodedValue(),
                b[i].getEncodedValue())) {
            return false;
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ClientId.java

示例6: LdapReferralException

import javax.naming.ldap.Control; //导入依赖的package包/类
/**
 * Constructs a new instance of LdapReferralException.
 * @param   resolvedName    The part of the name that has been successfully
 *                          resolved.
 * @param   resolvedObj     The object to which resolution was successful.
 * @param   remainingName   The remaining unresolved portion of the name.
 * @param   explanation     Additional detail about this exception.
 */
LdapReferralException(Name resolvedName,
    Object resolvedObj,
    Name remainingName,
    String explanation,
    Hashtable<?,?> envprops,
    String nextName,
    int handleReferrals,
    Control[] reqCtls) {

    super(explanation);

    if (debug)
        System.out.println("LdapReferralException constructor");

    setResolvedName(resolvedName);
    setResolvedObj(resolvedObj);
    setRemainingName(remainingName);
    this.envprops = envprops;
    this.nextName = nextName;
    this.handleReferrals = handleReferrals;

    // If following referral, request controls are passed to referral ctx
    this.reqCtls =
        (handleReferrals == LdapClient.LDAP_REF_FOLLOW ? reqCtls : null);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:LdapReferralException.java

示例7: getReferralContext

import javax.naming.ldap.Control; //导入依赖的package包/类
/**
 * Gets a context at which to continue processing.
 * The supplied environment properties and connection controls are used.
 */
public Context getReferralContext(Hashtable<?,?> newProps, Control[] connCtls)
    throws NamingException {

    if (debug)
        System.out.println("LdapReferralException.getReferralContext");

    LdapReferralContext refCtx = new LdapReferralContext(
        this, newProps, connCtls, reqCtls,
        nextName, skipThisReferral, handleReferrals);

    refCtx.setHopCount(hopCount + 1);

    if (skipThisReferral) {
        skipThisReferral = false; // reset
    }
    return (Context)refCtx;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:LdapReferralException.java

示例8: DigestClientId

import javax.naming.ldap.Control; //导入依赖的package包/类
DigestClientId(int version, String hostname, int port,
    String protocol, Control[] bindCtls, OutputStream trace,
    String socketFactory, String username,
    Object passwd, Hashtable<?,?> env) {

    super(version, hostname, port, protocol, bindCtls, trace,
        socketFactory, username, passwd);

    if (env == null) {
        propvals = null;
    } else {
        // Could be smarter and apply default values for props
        // but for now, we just record and check exact matches
        propvals = new String[SASL_PROPS.length];
        for (int i = 0; i < SASL_PROPS.length; i++) {
            propvals[i] = (String) env.get(SASL_PROPS[i]);
        }
    }
    myHash = super.hashCode() ^ Arrays.hashCode(propvals);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:DigestClientId.java

示例9: SimpleClientId

import javax.naming.ldap.Control; //导入依赖的package包/类
SimpleClientId(int version, String hostname, int port,
    String protocol, Control[] bindCtls, OutputStream trace,
    String socketFactory, String username, Object passwd) {

    super(version, hostname, port, protocol, bindCtls, trace,
            socketFactory);

    this.username = username;
    int pwdHashCode = 0;
    if (passwd == null) {
        this.passwd = null;
    } else if (passwd instanceof byte[]) {
        this.passwd = ((byte[])passwd).clone();
        pwdHashCode = Arrays.hashCode((byte[])passwd);
    } else if (passwd instanceof char[]) {
        this.passwd = ((char[])passwd).clone();
        pwdHashCode = Arrays.hashCode((char[])passwd);
    } else {
        this.passwd = passwd;
        pwdHashCode = passwd.hashCode();
    }

    myHash = super.hashCode()
        ^ (username != null ? username.hashCode() : 0)
        ^ pwdHashCode;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:SimpleClientId.java

示例10: main

import javax.naming.ldap.Control; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {
    Class<?> simpleClientIdClass
            = Class.forName("com.sun.jndi.ldap.SimpleClientId");
    Constructor<?> init = simpleClientIdClass.getDeclaredConstructor(
            int.class, String.class, int.class, String.class,
            Control[].class, OutputStream.class, String.class,
            String.class, Object.class);
    init.setAccessible(true);

    Object p1 = new byte[]{66,77};
    Object p2 = new char[]{'w','d'};
    Object p3 = "word";

    test(init, new byte[]{65}, new byte[]{65});
    test(init, new char[]{'p'}, new char[]{'p'});
    test(init, "pass", "pass");
    test(init, p1, p1);
    test(init, p2, p2);
    test(init, p3, p3);
    test(init, null, null);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:SimpleClientIdHashCode.java

示例11: pagedSearch

import javax.naming.ldap.Control; //导入依赖的package包/类
private List<SearchResult> pagedSearch(LdapContext ldapContext, String searchFilter) throws Exception {
    List<SearchResult> data = new ArrayList<SearchResult>();

    log.trace("Using paged ldap search, pageSize={}", pageSize);

    Control[] requestControls = new Control[]{new PagedResultsControl(pageSize, Control.CRITICAL)};
    ldapContext.setRequestControls(requestControls);
    do {
        List<SearchResult> pageResult = simpleSearch(ldapContext, searchFilter);
        data.addAll(pageResult);
        log.trace("Page returned {} entries", pageResult.size());
    } while (prepareNextPage(ldapContext));

    if (log.isDebugEnabled()) {
        log.debug("Found a total of {} entries for ldap filter {}", data.size(), searchFilter);
    }

    return data;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:LdapProducer.java


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