#1215 - Update RFC-5988 references to RFC-8288.
Update code, javadoc, and documentation changes.
This commit is contained in:
committed by
Greg Turnquist
parent
31a8f77acd
commit
1f49360637
@@ -39,7 +39,7 @@ include::{code-dir}/FundamentalsTest.java[tags=links]
|
||||
----
|
||||
====
|
||||
|
||||
`Link` exposes other attributes as defined in https://tools.ietf.org/html/rfc5988[RFC-5988].
|
||||
`Link` exposes other attributes as defined in https://tools.ietf.org/html/rfc8288[RFC-8288].
|
||||
You can set them by calling the corresponding wither method on a `Link` instance.
|
||||
|
||||
Find more information on how to create links pointing to Spring MVC and Spring WebFlux controllers in <<server.link-builder.webmvc>> and <<server.link-builder.webflux>>.
|
||||
|
||||
@@ -136,7 +136,7 @@ This will result in the following HAL representation:
|
||||
[[mediatypes.hal.curie-provider]]
|
||||
=== [[spis.curie-provider]] Using the `CurieProvider` API
|
||||
|
||||
The https://tools.ietf.org/html/rfc5988=section-4[Web Linking RFC] describes registered and extension link relation types. Registered rels are well-known strings registered with the https://www.iana.org/assignments/link-relations/link-relations.xhtml[IANA registry of link relation types]. Extension `rel` URIs can be used by applications that do not wish to register a relation type. Each one is a URI that uniquely identifies the relation type. The `rel` URI can be serialized as a compact URI or https://www.w3.org/TR/curie[Curie]. For example, a curie of `ex:persons` stands for the link relation type `https://example.com/rels/persons` if `ex` is defined as `https://example.com/rels/{rel}`. If curies are used, the base URI must be present in the response scope.
|
||||
The https://tools.ietf.org/html/rfc8288#section-2.1[Web Linking RFC] describes registered and extension link relation types. Registered rels are well-known strings registered with the https://www.iana.org/assignments/link-relations/link-relations.xhtml[IANA registry of link relation types]. Extension `rel` URIs can be used by applications that do not wish to register a relation type. Each one is a URI that uniquely identifies the relation type. The `rel` URI can be serialized as a compact URI or https://www.w3.org/TR/curie[Curie]. For example, a curie of `ex:persons` stands for the link relation type `https://example.com/rels/persons` if `ex` is defined as `https://example.com/rels/{rel}`. If curies are used, the base URI must be present in the response scope.
|
||||
|
||||
The `rel` values created by the default `RelProvider` are extension relation types and, as a result, must be URIs, which can cause a lot of overhead. The `CurieProvider` API takes care of that: It lets you define a base URI as a URI template and a prefix that stands for that base URI. If a `CurieProvider` is present, the `RelProvider` prepends all `rel` values with the curie prefix. Furthermore a `curies` link is automatically added to the HAL resource.
|
||||
|
||||
|
||||
@@ -462,18 +462,18 @@ public class Link implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to easily create {@link Link} instances from RFC-5988 compatible {@link String} representations of a
|
||||
* Factory method to easily create {@link Link} instances from RFC-8288 compatible {@link String} representations of a
|
||||
* link.
|
||||
*
|
||||
* @param element an RFC-5899 compatible representation of a link.
|
||||
* @throws IllegalArgumentException if a {@link String} was given that does not adhere to RFC-5899.
|
||||
* @param element an RFC-8288 compatible representation of a link.
|
||||
* @throws IllegalArgumentException if a {@link String} was given that does not adhere to RFC-8288.
|
||||
* @throws IllegalArgumentException if no {@code rel} attribute could be found.
|
||||
* @return
|
||||
*/
|
||||
public static Link valueOf(String element) {
|
||||
|
||||
if (!StringUtils.hasText(element)) {
|
||||
throw new IllegalArgumentException(String.format("Given link header %s is not RFC5988 compliant!", element));
|
||||
throw new IllegalArgumentException(String.format("Given link header %s is not RFC-8288 compliant!", element));
|
||||
}
|
||||
|
||||
Matcher matcher = URI_AND_ATTRIBUTES_PATTERN.matcher(element);
|
||||
@@ -519,7 +519,7 @@ public class Link implements Serializable {
|
||||
return link;
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("Given link header %s is not RFC5988 compliant!", element));
|
||||
throw new IllegalArgumentException(String.format("Given link header %s is not RFC-8288 compliant!", element));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class Links implements Iterable<Link> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Links} instance from the given RFC5988-compatible link format.
|
||||
* Creates a {@link Links} instance from the given RFC-8288-compatible link format.
|
||||
*
|
||||
* @param source a comma separated list of {@link Link} representations.
|
||||
* @return the {@link Links} represented by the given {@link String}.
|
||||
@@ -91,7 +91,7 @@ public class Links implements Iterable<Link> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Links} instance from the given RFC5988-compatible link format.
|
||||
* Creates a {@link Links} instance from the given RFC-8288-compatible link format.
|
||||
*
|
||||
* @param source a comma separated list of {@link Link} representations.
|
||||
* @return the {@link Links} represented by the given {@link String}.
|
||||
|
||||
@@ -125,7 +125,7 @@ class LinkUnitTest {
|
||||
* @see #678
|
||||
*/
|
||||
@Test
|
||||
void parsesRFC5988HeaderIntoLink() {
|
||||
void parsesRFC8288HeaderIntoLink() {
|
||||
|
||||
assertSoftly(softly -> {
|
||||
|
||||
@@ -184,7 +184,7 @@ class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsNonRFC5988String() {
|
||||
void rejectsNonRFC8288String() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link.valueOf("foo");
|
||||
|
||||
@@ -96,7 +96,7 @@ class LinksUnitTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://tools.ietf.org/html/rfc5988#section-5.5
|
||||
* @see https://tools.ietf.org/html/rfc8288#section-3.5
|
||||
*/
|
||||
@Test
|
||||
void parsesLinksWithWhitespace() {
|
||||
|
||||
@@ -111,7 +111,7 @@ class DefaultCurieProviderUnitTest {
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
void prefixesNormalRelsThatHaveExtraRFC5988Attributes() {
|
||||
void prefixesNormalRelsThatHaveExtraRFC8288Attributes() {
|
||||
|
||||
Link link = Link.of("https://amazon.com", "custom:rel") //
|
||||
.withHreflang("en") //
|
||||
|
||||
@@ -122,7 +122,7 @@ class Jackson2HalIntegrationTest {
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
void rendersAllExtraRFC5988Attributes() throws Exception {
|
||||
void rendersAllExtraRFC8288Attributes() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(Link.of("localhost", "self") //
|
||||
@@ -141,7 +141,7 @@ class Jackson2HalIntegrationTest {
|
||||
* @see #699
|
||||
*/
|
||||
@Test
|
||||
void deserializeAllExtraRFC5988Attributes() throws Exception {
|
||||
void deserializeAllExtraRFC8288Attributes() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(Link.of("localhost", "self") //
|
||||
@@ -154,7 +154,7 @@ class Jackson2HalIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void rendersWithOneExtraRFC5988Attribute() throws Exception {
|
||||
void rendersWithOneExtraRFC8288Attribute() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(Link.of("localhost", "self").withTitle("the title"));
|
||||
@@ -166,7 +166,7 @@ class Jackson2HalIntegrationTest {
|
||||
* @see #699
|
||||
*/
|
||||
@Test
|
||||
void deserializeOneExtraRFC5988Attribute() throws Exception {
|
||||
void deserializeOneExtraRFC8288Attribute() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(Link.of("localhost", "self").withTitle("the title"));
|
||||
|
||||
Reference in New Issue
Block a user