Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 3.7.1 (2018-09-??)

* [fix] Fix HTTP headers sent when the NO_CACHE policy is applied on a JAX-RS resource (the default).

# Version 3.7.0 (2018-07-31)

* [new] Bean Validation 2.0 support through Hibernate Validator 6 implementation.
Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion rest/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-rest</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-rest-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion rest/jersey2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-rest</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-rest-jersey2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void configure(ResourceInfo resourceInfo, FeatureContext featureContext)
}

private static class CacheResponseFilter implements ContainerResponseFilter {
private static final String MUST_REVALIDATE_PRIVATE = "must revalidate, private";
private final CachePolicy policy;

CacheResponseFilter(CachePolicy policy) {
Expand All @@ -63,9 +62,19 @@ public void filter(ContainerRequestContext requestContext,
switch (this.policy) {
case NO_CACHE:
MultivaluedMap<String, Object> headers = responseContext.getHeaders();
headers.putSingle(HttpHeaders.LAST_MODIFIED, new Date());
headers.putSingle(HttpHeaders.EXPIRES, -1);
headers.putSingle(HttpHeaders.CACHE_CONTROL, MUST_REVALIDATE_PRIVATE);

// HTTP Caching is a tough subject thanks to the diversity of clients (browser and cache/proxy servers)
// See below a pretty good reference on HTTP Caching:
// https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers

// For client that doesn't support newer `Cache-Control` HTTP header
// https://tools.ietf.org/html/rfc7234#section-5.3
headers.putSingle(HttpHeaders.EXPIRES, 0);

// https://tools.ietf.org/html/rfc7234#section-5.2.2
// Theoretically, `no-store` only would be sufficient
// But for compatibility-purpose, adding other related headers doesn't hurt
headers.putSingle(HttpHeaders.CACHE_CONTROL, "no-store, no-cache, must-revalidate, private");
break;
case CUSTOM:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public void basicAsyncResource() throws JSONException {
@Test
public void cacheIsDisabledByDefault() {
Response response = expect().statusCode(200).when().get(baseUrl + "hello");
assertThat(response.header("Last-Modified")).isNotEmpty();
assertThat(response.header("Expires")).isEqualTo("-1");
assertThat(response.header("Cache-Control")).isEqualTo("must revalidate, private");
assertThat(response.header("Expires")).isEqualTo("0");
assertThat(response.header("Cache-Control")).isEqualTo("no-store, no-cache, must-revalidate, private");
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-rest</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion rest/specs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-rest</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-rest-specs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion security/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-security</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-security-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion security/specs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-security</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-security-specs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion specs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-specs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testing/arquillian/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-testing</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-testing-arquillian</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testing/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-testing</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-testing-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testing/junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-testing</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-testing-junit4</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-testing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testing/specs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-testing</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-testing-specs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion web/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-web-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-web</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion web/security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-web-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion web/specs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-web-specs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion web/undertow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web</artifactId>
<version>3.7.0-SNAPSHOT</version>
<version>3.7.1-SNAPSHOT</version>
</parent>

<artifactId>seed-web-undertow</artifactId>
Expand Down