diff --git a/src/main/java/org/springframework/hateoas/PagedResources.java b/src/main/java/org/springframework/hateoas/PagedResources.java index 0d14f9d..4601c80 100644 --- a/src/main/java/org/springframework/hateoas/PagedResources.java +++ b/src/main/java/org/springframework/hateoas/PagedResources.java @@ -172,9 +172,13 @@ */ public static class PageMetadata { + @JsonView(ResourcesLinksVisible.class) @XmlAttribute @JsonProperty private long size; + @JsonView(ResourcesLinksVisible.class) @XmlAttribute @JsonProperty private long totalElements; + @JsonView(ResourcesLinksVisible.class) @XmlAttribute @JsonProperty private long totalPages; + @JsonView(ResourcesLinksVisible.class) @XmlAttribute @JsonProperty private long number; protected PageMetadata() { diff --git a/src/main/java/org/springframework/hateoas/hal/Jackson2HalModule.java b/src/main/java/org/springframework/hateoas/hal/Jackson2HalModule.java index bb0f4a8..05d9e0d 100644 --- a/src/main/java/org/springframework/hateoas/hal/Jackson2HalModule.java +++ b/src/main/java/org/springframework/hateoas/hal/Jackson2HalModule.java @@ -34,9 +34,11 @@ import org.springframework.hateoas.Resource; import org.springframework.hateoas.ResourceSupport; import org.springframework.hateoas.Resources; +import org.springframework.hateoas.ResourcesLinksVisible; import org.springframework.util.Assert; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.core.JsonGenerationException; @@ -884,11 +886,13 @@ } @JsonUnwrapped + @JsonView(ResourcesLinksVisible.class) public Link getLink() { return link; } @JsonInclude(Include.NON_NULL) + @JsonView(ResourcesLinksVisible.class) public String getTitle() { return title; } diff --git a/src/test/java/org/springframework/hateoas/alps/JacksonSerializationTest.java b/src/test/java/org/springframework/hateoas/alps/JacksonSerializationTest.java index 44e47a9..dd9138b 100644 --- a/src/test/java/org/springframework/hateoas/alps/JacksonSerializationTest.java +++ b/src/test/java/org/springframework/hateoas/alps/JacksonSerializationTest.java @@ -15,10 +15,6 @@ */ package org.springframework.hateoas.alps; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.springframework.hateoas.alps.Alps.*; - import java.io.IOException; import java.util.Arrays; import java.util.Scanner; @@ -31,6 +27,13 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.springframework.hateoas.alps.Alps.alps; +import static org.springframework.hateoas.alps.Alps.descriptor; +import static org.springframework.hateoas.alps.Alps.doc; +import static org.springframework.hateoas.alps.Alps.ext; /** * Unit tests for serialization of ALPS documents. @@ -87,7 +90,7 @@ builder.append(scanner.nextLine()); if (scanner.hasNextLine()) { - builder.append("\n"); + builder.append(System.getProperty("line.separator")); } }