mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 08:30:11 +02:00
Add next page navigation for RDAP nameserver searches
Domain and entity searches will be handled in future CLs. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=178912832
This commit is contained in:
parent
7dc224627f
commit
359bab291b
12 changed files with 486 additions and 62 deletions
|
@ -436,6 +436,33 @@ public class RdapJsonFormatter {
|
|||
return jsonBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a JSON object containing a notice with a next page navigation link, which can then be
|
||||
* inserted into a notices array.
|
||||
*
|
||||
* <p>At the moment, only a next page link is supported. Other types of links (e.g. previous page)
|
||||
* could be added in the future, but it's not clear how to generate such links, given the way we
|
||||
* are querying the database.
|
||||
*
|
||||
* @param nextPageUrl URL string used to navigate to next page, or empty if there is no next
|
||||
*/
|
||||
static ImmutableMap<String, Object> makeRdapJsonNavigationLinkNotice(
|
||||
Optional<String> nextPageUrl) {
|
||||
ImmutableMap.Builder<String, Object> jsonBuilder = new ImmutableMap.Builder<>();
|
||||
jsonBuilder.put("title", "Navigation Links");
|
||||
jsonBuilder.put("description", ImmutableList.of("Links to related pages."));
|
||||
if (nextPageUrl.isPresent()) {
|
||||
jsonBuilder.put(
|
||||
"links",
|
||||
ImmutableList.of(
|
||||
ImmutableMap.of(
|
||||
"rel", "next",
|
||||
"href", nextPageUrl.get(),
|
||||
"type", "application/rdap+json")));
|
||||
}
|
||||
return jsonBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a JSON object for a {@link DomainResource}.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue