|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
, DirContext


public interface LdapContext

This interface represents a context in which you can perform operations with LDAPv3-style controls and perform LDAPv3-style extended operations. For applications that do not require such controls or extended operations, the more generic javax.naming.directory.DirContext should be used instead.
There are two types of request controls:
Unless explicitly qualified, the term "request controls" refers to context request controls.
Unlike environment properties, request controls of a context instance are not inherited by context instances that are derived from it. Derived context instances have null as their context request controls. You must set the request controls of a derived context instance explicitly using setRequestControls().
A context instance's request controls are retrieved using the method getRequestControls().
Like environment properties, connection request controls of a context are inherited by contexts that are derived from it. Typically, you initialize the connection request controls using the InitialLdapContext constructor or LdapReferralContext.getReferralContext(). These connection request controls are inherited by contexts that share the same connection--that is, contexts derived from the initial or referral contexts.
Use reconnect() to change the connection request controls of a context. Invoking ldapContext.reconnect() affects only the connection used by ldapContext and any new contexts instances that are derived form ldapContext. Contexts that previously shared the connection with ldapContext remain unchanged. That is, a context's connection request controls must be explicitly changed and is not affected by changes to another context's connection request controls.
A context instance's connection request controls are retrieved using the method getConnectControls().
InitialLdapContext
,
LdapReferralException.getReferralContext(java.util.Hashtable,javax.naming.ldap.Control[])

| Field Summary | |
|---|---|
static String |
CONTROL_FACTORIES
Constant that holds the name of the environment property for specifying the list of control factories to use. |
Fields inherited from interface javax.naming.directory.DirContext ![]() |
|---|
ADD_ATTRIBUTE |
Fields inherited from interface javax.naming.Context ![]() |
|---|
APPLET |
| Method Summary | |
|---|---|
ExtendedResponse |
extendedOperation
Performs an extended operation. |
Control |
getConnectControls
Retrieves the connection request controls in effect for this context. |
Control |
getRequestControls
Retrieves the request controls in effect for this context. |
Control |
getResponseControls
Retrieves the response controls produced as a result of the last method invoked on this context. |
LdapContext |
newInstance
Creates a new instance of this context initialized using request controls. |
void |
reconnect
Reconnects to the LDAP server using the supplied controls and this context's environment. |
void |
setRequestControls
Sets the request controls for methods subsequently invoked on this context. |
Methods inherited from interface javax.naming.directory.DirContext ![]() |
|---|
bind |
Methods inherited from interface javax.naming.Context ![]() |
|---|
addToEnvironment |
| Field Detail |
|---|

static final String![]()
![]()
CONTROL_FACTORIES
The value of this constant is "java.naming.factory.control".
ControlFactory
,
Context.addToEnvironment(java.lang.String, java.lang.Object)
,
Context.removeFromEnvironment(java.lang.String)
,
Constant Field Values| Method Detail |
|---|

ExtendedResponse![]()
![]()
extendedOperation(ExtendedRequest
![]()
![]()
request) throws NamingException
![]()
![]()
request - The non-null request to be performed.
NamingException

- If an error occurred while performing the
extended operation.

LdapContext![]()
![]()
newInstance(Control
![]()
![]()
[] requestControls) throws NamingException
![]()
![]()
The new context has the same environment properties and connection request controls as this context. See the class description for details. Implementations might also allow this context and the new context to share the same network connection or other resources if doing so does not impede the independence of either context.
requestControls - The possibly null request controls
to use for the new context.
If null, the context is initialized with no request controls.
NamingException

- If an error occurred while creating
the new instance.InitialLdapContext


void reconnect(Control![]()
![]()
[] connCtls) throws NamingException
![]()
![]()
This method is a way to explicitly initiate an LDAP "bind" operation. For example, you can use this method to set request controls for the LDAP "bind" operation, or to explicitly connect to the server to get response controls returned by the LDAP "bind" operation.
This method sets this context's connCtls to be its new connection request controls. This context's context request controls are not affected. After this method has been invoked, any subsequent implicit reconnections will be done using connCtls. connCtls are also used as connection request controls for new context instances derived from this context. These connection request controls are not affected by setRequestControls().
Service provider implementors should read the "Service Provider" section in the class description for implementation details.
connCtls - The possibly null controls to use. If null, no
controls are used.
NamingException

- If an error occurred while reconnecting.getConnectControls()
,
newInstance(javax.naming.ldap.Control[])


Control![]()
![]()
[] getConnectControls() throws NamingException
![]()
![]()
NamingException

- If an error occurred while getting the request
controls.

void setRequestControls(Control![]()
![]()
[] requestControls) throws NamingException
![]()
![]()
This removes any previous request controls and adds requestControls for use by subsequent methods invoked on this context. This method does not affect this context's connection request controls.
Note that requestControls will be in effect until the next invocation of setRequestControls(). You need to explicitly invoke setRequestControls() with null or an empty array to clear the controls if you don't want them to affect the context methods any more. To check what request controls are in effect for this context, use getRequestControls().
requestControls - The possibly null controls to use. If null, no
controls are used.
NamingException

- If an error occurred while setting the
request controls.getRequestControls()


Control![]()
![]()
[] getRequestControls() throws NamingException
![]()
![]()
NamingException ![]()