javax.naming
Class 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,
which is generated in response to a referral
such as that returned by LDAP v3 servers.
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.
- See Also:
- Serialized Form
Constructor Summary |
protected |
ReferralException()
Constructs a new instance of ReferralException. |
protected |
ReferralException(java.lang.String explanation)
Constructs a new instance of ReferralException using the
explanation supplied. |
Method Summary |
abstract Context |
getReferralContext()
Retrieves the context at which to continue the method. |
abstract java.lang.Object |
getReferralInfo()
Retrieves information (such as URLs) related to this referral. |
abstract boolean |
skipReferral()
Discards the referral about to be processed. |
Methods inherited from class javax.naming.NamingException |
appendRemainingComponent,
appendRemainingName,
getExplanation,
getRemainingName,
getResolvedName,
getResolvedObj,
getRootCause,
setRemainingName,
setResolvedName,
setResolvedObj,
setRootCause,
toString,
toString |
Methods inherited from class java.lang.Throwable |
fillInStackTrace,
getLocalizedMessage,
getMessage,
printStackTrace,
printStackTrace,
printStackTrace |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
ReferralException
protected ReferralException(java.lang.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:
Throwable.getMessage()
ReferralException
protected ReferralException()
- Constructs a new instance of ReferralException.
All fields are set to null.
getReferralInfo
public abstract java.lang.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.
For more information on JNDI, please see http://java.sun.com/products/jndi