mirror of
https://github.com/google/nomulus
synced 2026-06-09 16:33:02 +00:00
Remove 'value' from RDAP link responses (#236)
* Remove 'value' from RDAP link responses * Change application type to rdap+json * Merge remote-tracking branch 'origin/master' into removeValueRdap * CR response
This commit is contained in:
@@ -47,13 +47,6 @@ public class RdapHelpAction extends RdapActionBase {
|
||||
}
|
||||
|
||||
private Notice createHelpNotice() {
|
||||
String linkValue = rdapJsonFormatter.makeRdapServletRelativeUrl("help");
|
||||
Link.Builder linkBuilder =
|
||||
Link.builder()
|
||||
.setValue(linkValue)
|
||||
.setRel("alternate")
|
||||
.setHref(RDAP_HELP_LINK)
|
||||
.setType("text/html");
|
||||
return Notice.builder()
|
||||
.setTitle("RDAP Help")
|
||||
.setDescription(
|
||||
@@ -68,13 +61,19 @@ public class RdapHelpAction extends RdapActionBase {
|
||||
"entities?fn=XXXX",
|
||||
"entities?handle=XXXX",
|
||||
"help/XXXX")
|
||||
.addLink(linkBuilder.build())
|
||||
.addLink(
|
||||
Link.builder().setHref(RDAP_HELP_LINK).setRel("alternate").setType("text/html").build())
|
||||
.addLink(
|
||||
Link.builder()
|
||||
.setHref(rdapJsonFormatter.makeRdapServletRelativeUrl("help"))
|
||||
.setRel("self")
|
||||
.setType("application/rdap+json")
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpResponse getJsonObjectForResource(
|
||||
String pathSearchString, boolean isHeadRequest) {
|
||||
public HelpResponse getJsonObjectForResource(String pathSearchString, boolean isHeadRequest) {
|
||||
if (pathSearchString.isEmpty() || pathSearchString.equals("/")) {
|
||||
return HelpResponse.create(Optional.of(createHelpNotice()));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ public class RdapIcannStandardInformation {
|
||||
+ " https://icann.org/epp")
|
||||
.addLink(
|
||||
Link.builder()
|
||||
.setValue("https://icann.org/epp")
|
||||
.setRel("alternate")
|
||||
.setHref("https://icann.org/epp")
|
||||
.setType("text/html")
|
||||
@@ -59,7 +58,6 @@ public class RdapIcannStandardInformation {
|
||||
"URL of the ICANN RDDS Inaccuracy Complaint Form: https://www.icann.org/wicf")
|
||||
.addLink(
|
||||
Link.builder()
|
||||
.setValue("https://www.icann.org/wicf")
|
||||
.setRel("alternate")
|
||||
.setHref("https://www.icann.org/wicf")
|
||||
.setType("text/html")
|
||||
@@ -145,8 +143,6 @@ public class RdapIcannStandardInformation {
|
||||
.setType(Remark.Type.OBJECT_REDACTED_AUTHORIZATION)
|
||||
.addLink(
|
||||
Link.builder()
|
||||
.setValue(
|
||||
"https://github.com/google/nomulus/blob/master/docs/rdap.md#authentication")
|
||||
.setRel("alternate")
|
||||
.setHref(
|
||||
"https://github.com/google/nomulus/blob/master/docs/rdap.md#authentication")
|
||||
|
||||
@@ -228,20 +228,25 @@ public class RdapJsonFormatter {
|
||||
/** Creates the TOS notice that is added to every reply. */
|
||||
Notice createTosNotice() {
|
||||
String linkValue = makeRdapServletRelativeUrl("help", RdapHelpAction.TOS_PATH);
|
||||
Link.Builder linkBuilder = Link.builder()
|
||||
.setValue(linkValue);
|
||||
if (rdapTosStaticUrl == null) {
|
||||
linkBuilder.setRel("self").setHref(linkValue).setType("application/rdap+json");
|
||||
} else {
|
||||
Link selfLink =
|
||||
Link.builder().setRel("self").setHref(linkValue).setType("application/rdap+json").build();
|
||||
|
||||
Notice.Builder noticeBuilder =
|
||||
Notice.builder()
|
||||
.setTitle("RDAP Terms of Service")
|
||||
.setDescription(rdapTos)
|
||||
.addLink(selfLink);
|
||||
if (rdapTosStaticUrl != null) {
|
||||
URI htmlBaseURI = URI.create(fullServletPath);
|
||||
URI htmlUri = htmlBaseURI.resolve(rdapTosStaticUrl);
|
||||
linkBuilder.setRel("alternate").setHref(htmlUri.toString()).setType("text/html");
|
||||
noticeBuilder.addLink(
|
||||
Link.builder()
|
||||
.setRel("alternate")
|
||||
.setHref(htmlUri.toString())
|
||||
.setType("text/html")
|
||||
.build());
|
||||
}
|
||||
return Notice.builder()
|
||||
.setTitle("RDAP Terms of Service")
|
||||
.setDescription(rdapTos)
|
||||
.addLink(linkBuilder.build())
|
||||
.build();
|
||||
return noticeBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +319,6 @@ public class RdapJsonFormatter {
|
||||
.add(
|
||||
Link.builder()
|
||||
.setHref(href)
|
||||
.setValue(href)
|
||||
.setRel("related")
|
||||
.setType("application/rdap+json")
|
||||
.build());
|
||||
@@ -1078,7 +1082,6 @@ public class RdapJsonFormatter {
|
||||
private Link makeSelfLink(String type, String name) {
|
||||
String url = makeRdapServletRelativeUrl(type, name);
|
||||
return Link.builder()
|
||||
.setValue(url)
|
||||
.setRel("self")
|
||||
.setHref(url)
|
||||
.setType("application/rdap+json")
|
||||
|
||||
Reference in New Issue
Block a user