All Packages Class Hierarchy This Package Previous Next Index
Class javax.naming.ReferralException
java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----javax.naming.NamingException
|
+----javax.naming.ReferralException
- public abstract class ReferralException
- extends NamingException
This abstract class is used to represent a referral exception,
such as that available in LDAP v3. A service provider provides
a subclass of ReferralException by providing implementations
for getReferralInfo() and getReferralContext() (and appropriate
constructors and/or corresponding "set" methods).
The following code sample shows how ReferralException can be used.
while (true) {
try {
bindings = ctx.listBindings(name);
while (bindings.hasMore()) {
b = bindings.next();
...
}
break;
} catch (ReferralException e) {
ctx = e.getReferralContext();
}
}
ReferralException is an abstract class. Concrete implementations of it
determine its synchronization and serialization properties.
-
ReferralException()
- Constructs a new instance of ReferralException.
-
ReferralException(String)
- Constructs a new instance of ReferralException using the
explanation supplied.
-
getReferralContext()
- Retrieves the context at which to continue the method.
-
getReferralInfo()
- Retrieves information (such as URLs) related to this referral.
-
skipReferral()
- Discards the referral about to be processed.
ReferralException
protected ReferralException(String explanation)
- Constructs a new instance of ReferralException using the
explanation supplied. All other fields are set to null.
- Parameters:
- explanation - Additional detail about this exception. Can be null.
- See Also:
- getMessage
ReferralException
protected ReferralException()
- Constructs a new instance of ReferralException.
All fields are set to null.
getReferralInfo
public abstract Object getReferralInfo()
- Retrieves information (such as URLs) related to this referral.
The program may examine or display this information
to the user to determine whether to continue with the referral,
or to determine additional information needs to be supplied in order
to continue with the referral.
- Returns:
- Non-null referral information related to this referral.
getReferralContext
public abstract Context getReferralContext() throws NamingException
- Retrieves the context at which to continue the method.
Regardless of whether a referral is encountered directly during a
context operation, or indirectly, for example, during a search
enumeration, the referral exception should provide a context
at which to continue the operation.
To continue the operation, the client program should re-invoke
the method using the same arguments as the original invocation.
- Returns:
- The context at which to continue the method.
- Throws: NamingException
- If a naming exception was encountered.
skipReferral
public abstract boolean skipReferral()
- Discards the referral about to be processed.
A call to this method should be followed by a call to
getReferralContext
to allow the processing of
other referrals to continue.
The following code fragment shows a typical usage pattern.
} catch (ReferralException e) {
if (!shallIFollow(e.getReferralInfo())) {
if (!e.skipReferral()) {
return;
}
}
ctx = e.getReferralContext();
}
- Returns:
- true If more referral processing is pending; false otherwise.
All Packages Class Hierarchy This Package Previous Next Index