-  
       
- All Superinterfaces:
 -  
         
Serializable 
- 所有已知实现类:
 -  
         
StartTlsRequest 
public interface ExtendedRequest extends Serializable
此接口表示RFC 2251中定义的LDAPv3扩展操作请求。ExtendedRequest ::= [APPLICATION 23] SEQUENCE { requestName [0] LDAPOID, requestValue [1] OCTET STRING OPTIONAL }它包括对象标识符字符串和可选的ASN.1 BER编码值。服务提供程序使用此类中的方法构造要发送到LDAP服务器的位。 应用程序通常只处理实现此接口的类,为它们提供特定扩展操作请求所需的任何信息。 然后,它将这样的类作为参数传递给
LdapContext.extendedOperation()方法,以执行LDAPv3扩展操作。例如,假设LDAP服务器支持“获取时间”扩展操作。 它将提供GetTimeRequest和GetTimeResponse类:
程序将使用这些类,如下所示:public class GetTimeRequest implements ExtendedRequest { public GetTimeRequest() {... }; public ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length) throws NamingException { return new GetTimeResponse(id, berValue, offset, length); } ... } public class GetTimeResponse implements ExtendedResponse { long time; public GetTimeResponse(String id, byte[] berValue, int offset, int length) throws NamingException { time = ... // decode berValue to get time } public java.util.Date getDate() { return new java.util.Date(time) }; public long getTime() { return time }; ... }GetTimeResponse resp = (GetTimeResponse) ectx.extendedOperation(new GetTimeRequest()); long time = resp.getTime();- 从以下版本开始:
 - 1.3
 - 另请参见:
 -  
         
ExtendedResponse,LdapContext.extendedOperation(javax.naming.ldap.ExtendedRequest) 
 
-  
        
       
-  
             
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 ExtendedResponsecreateExtendedResponse(String id, byte[] berValue, int offset, int length)创建与此请求对应的响应对象。byte[]getEncodedValue()检索LDAP扩展操作请求的ASN.1 BER编码值。StringgetID()检索请求的对象标识符。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
getID
String getID()
检索请求的对象标识符。- 结果
 - 
               表示LDAP 
              
ExtendedRequest.requestName组件的非null对象标识符字符串。 
 
-  
getEncodedValue
byte[] getEncodedValue()
检索LDAP扩展操作请求的ASN.1 BER编码值。 如果值不存在,则返回Null。 结果是原始BER字节,包括标记和请求值的长度。 它不包括请求OID。 服务提供程序调用此方法以获取要放入扩展操作的位以发送到LDAP服务器。- 结果
 - 
               可能为null的字节数组,表示LDAP 
              
ExtendedRequest.requestValue组件的ASN.1 BER编码内容。 - 异常
 -  
              
IllegalStateException- 如果由于请求包含的数据/状态不足或无效而无法检索编码值。 
 
-  
createExtendedResponse
ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length) throws NamingException
创建与此请求对应的响应对象。在服务提供者将扩展操作请求发送到LDAP服务器之后,它将从服务器接收响应。 如果操作失败,提供程序将抛出NamingException。 如果操作成功,提供程序将使用它在响应中返回的数据调用此方法。 返回实现适用于扩展操作请求的ExtendedResponse接口的类是此方法的作用。
例如,Start TLS扩展请求类需要知道如何处理Start TLS扩展响应。 它通过创建实现ExtendedResponse的类来实现。
- 参数
 -  
              
id- 响应控件的可能为null的对象标识符。 -  
              
berValue- 响应控制的可能为空的ASN.1 BER编码值。 这是原始BER字节,包括标记和响应值的长度。 它不包括响应OID。 -  
              
offset- berValue中要使用的字节的起始位置。 -  
              
length- 要使用的berValue中的字节数。 - 结果
 - 非null对象。
 - 异常
 -  
              
NamingException- 如果由于错误而无法创建扩展响应。 - 另请参见:
 -  
              
ExtendedResponse 
 
 -  
 
 -