RDAP: Always use summary output format for registrar entities

For domains (and soon for hosts as well), we output data about the owning registrar. These subrecords wind up being really big if we include all data, because they also list all the registrar contacts. To avoid bloating the RDAP responses, change to output domain response registrar information in summary format, meaning we skip the registrar contacts and events. The requester can still get this information by using the link provided to request the registrar directly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209189993
This commit is contained in:
mountford 2018-08-17 12:34:13 -07:00 committed by jianglai
parent 0065e52d84
commit 7dcadaecf6
11 changed files with 65 additions and 484 deletions

View file

@ -545,12 +545,7 @@ public class RdapJsonFormatter {
}
entities =
addRegistrarEntity(
entities,
domainResource.getCurrentSponsorClientId(),
linkBase,
whoisServer,
now,
outputDataType);
entities, domainResource.getCurrentSponsorClientId(), linkBase, whoisServer, now);
if (!entities.isEmpty()) {
jsonBuilder.put("entities", entities);
}
@ -582,22 +577,21 @@ public class RdapJsonFormatter {
}
/**
* Adds a JSON object for the desired registrar to an existing array of JSON objects.
* Adds a JSON object for the desired registrar to an existing list of JSON objects.
*
* @param entities list of entities to which the desired registrar should be added
* @param clientId the registrar client ID
* @param linkBase the URL base to be used when creating links
* @param whoisServer the fully-qualified domain name of the WHOIS server to be listed in the
* port43 field; if null, port43 is not added to the object
* port43 field; if null, port43 is not added to the object
* @param now the as-date
* @param outputDataType whether to generate full or summary data
*/
ImmutableList<ImmutableMap<String, Object>> addRegistrarEntity(
ImmutableList<ImmutableMap<String, Object>> entities,
@Nullable String clientId,
@Nullable String linkBase,
@Nullable String whoisServer,
DateTime now,
OutputDataType outputDataType) {
DateTime now) {
if (clientId == null) {
return entities;
}
@ -609,7 +603,12 @@ public class RdapJsonFormatter {
builder.addAll(entities);
builder.add(
makeRdapJsonForRegistrar(
registrar.get(), false /* isTopLevel */, linkBase, whoisServer, now, outputDataType));
registrar.get(),
false /* isTopLevel */,
linkBase,
whoisServer,
now,
OutputDataType.SUMMARY));
return builder.build();
}