| | |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.util.Utils; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines the structures and methods for an LDAP extended response |
| | | * protocol op, which is used to provide information about the result of |
| | |
| | | stream.writeOctetString(errorMessage.toString()); |
| | | } |
| | | |
| | | if ((referralURLs != null) && (! referralURLs.isEmpty())) |
| | | if (referralURLs != null && !referralURLs.isEmpty()) |
| | | { |
| | | stream.writeStartSequence(TYPE_REFERRAL_SEQUENCE); |
| | | for (String s : referralURLs) |
| | |
| | | stream.writeEndSequence(); |
| | | } |
| | | |
| | | if ((oid != null) && (oid.length() > 0)) |
| | | if (oid != null && oid.length() > 0) |
| | | { |
| | | stream.writeOctetString(TYPE_EXTENDED_RESPONSE_OID, oid); |
| | | } |
| | |
| | | buffer.append("ExtendedResponse(resultCode="); |
| | | buffer.append(resultCode); |
| | | |
| | | if ((errorMessage != null) && (errorMessage.length() > 0)) |
| | | if (errorMessage != null && errorMessage.length() > 0) |
| | | { |
| | | buffer.append(", errorMessage="); |
| | | buffer.append(errorMessage); |
| | | } |
| | | |
| | | if (matchedDN != null) |
| | | { |
| | | buffer.append(", matchedDN="); |
| | | buffer.append(matchedDN); |
| | | } |
| | | |
| | | if ((referralURLs != null) && (! referralURLs.isEmpty())) |
| | | if (referralURLs != null && !referralURLs.isEmpty()) |
| | | { |
| | | buffer.append(", referralURLs={"); |
| | | |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | buffer.append(Utils.joinAsString(", ", referralURLs)); |
| | | buffer.append("}"); |
| | | } |
| | | |
| | | if ((oid != null) && (oid.length() > 0)) |
| | | if (oid != null && oid.length() > 0) |
| | | { |
| | | buffer.append(", oid="); |
| | | buffer.append(oid); |
| | | } |
| | | |
| | | if (value != null) |
| | | { |
| | | buffer.append(", value="); |
| | |
| | | buffer.append(EOL); |
| | | } |
| | | |
| | | if ((referralURLs != null) && (! referralURLs.isEmpty())) |
| | | if (referralURLs != null && !referralURLs.isEmpty()) |
| | | { |
| | | buffer.append(indentBuf); |
| | | buffer.append(" Referral URLs: "); |
| | |
| | | } |
| | | } |
| | | |
| | | if ((oid != null) && (oid.length() > 0)) |
| | | if (oid != null && oid.length() > 0) |
| | | { |
| | | buffer.append(indentBuf); |
| | | buffer.append(" Response OID: "); |