[cxf] 01/02: Adding Client Cache tests for JAX-RS
This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git commit 128d12b9c8cc09a61660740239eac1a12276da77 Author: Colm O hEigeartaigh AuthorDate: Wed May 8 18:08:53 2019 +0100 Adding Client Cache tests for JAX-RS (cherry picked from commit 4fea734b1349ba023c2e560deda4aa0eaede7f3b) # Conflicts: # systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java --- systests/jaxrs/pom.xml | 12 ++ .../org/apache/cxf/systest/jaxrs/BookStore.java| 51 - .../systest/jaxrs/JAXRSClientServerBookTest.java | 125 - 3 files changed, 178 insertions(+), 10 deletions(-) diff --git a/systests/jaxrs/pom.xml b/systests/jaxrs/pom.xml index bb32fd3..90e8b81 100644 --- a/systests/jaxrs/pom.xml +++ b/systests/jaxrs/pom.xml @@ -546,6 +546,18 @@ ${cxf.reactor.version} test + +javax.cache +cache-api +${cxf.jcache.version} +test + + +org.ehcache +ehcache +${cxf.ehcache3.version} +test + diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java index fd218c4..f73df80 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java @@ -19,7 +19,6 @@ package org.apache.cxf.systest.jaxrs; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -32,6 +31,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; +import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; @@ -61,6 +61,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.container.ResourceContext; +import javax.ws.rs.core.CacheControl; import javax.ws.rs.core.Configuration; import javax.ws.rs.core.Context; import javax.ws.rs.core.Cookie; @@ -1030,17 +1031,59 @@ public class BookStore { return books.get(id + 123); } - - @GET @Path("/books/response/{bookId}/") @Produces("application/xml") public Response getBookAsResponse(@PathParam("bookId") String id) throws BookNotFoundFault { Book entity = doGetBook(id); EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); -return Response.ok().tag(etag).entity(entity).build(); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(10); +cacheControl.setPrivate(true); + +return Response.ok().tag(etag).entity(entity).cacheControl(cacheControl).build(); +} + +@GET +@Path("/books/response2/{bookId}/") +@Produces("application/xml") +public Response getBookAsResponse2(@PathParam("bookId") String id) throws BookNotFoundFault { +Book entity = doGetBook(id); +EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(1); +cacheControl.setPrivate(true); + +return Response.ok().tag(etag).entity(entity).cacheControl(cacheControl).build(); +} + +@GET +@Path("/books/response3/{bookId}/") +@Produces("application/xml") +public Response getBookAsResponse3(@PathParam("bookId") String id, + @HeaderParam("If-Modified-Since") String modifiedSince +) throws BookNotFoundFault { +Book entity = doGetBook(id); + +EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(1); +cacheControl.setPrivate(true); + +if (modifiedSince != null) { +return Response.status(304).tag(etag) +.cacheControl(cacheControl).lastModified(new Date()).build(); +} else { +return Response.ok().tag(etag).entity(entity) +.cacheControl(cacheControl).lastModified(new Date()).build(); +} } + + @GET @Path("/books/{bookId}/cglib") @Produces("application/xml") diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java index 54b3d20..663d187 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java @@ -43,7
[cxf] branch 3.2.x-fixes updated (aa007f2 -> ce7d8f3)
This is an automated email from the ASF dual-hosted git repository. coheigea pushed a change to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git. from aa007f2 Recording .gitmergeinfo Changes new 128d12b Adding Client Cache tests for JAX-RS new ce7d8f3 Recording .gitmergeinfo Changes The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .gitmergeinfo | 1 + systests/jaxrs/pom.xml | 12 ++ .../org/apache/cxf/systest/jaxrs/BookStore.java| 51 - .../systest/jaxrs/JAXRSClientServerBookTest.java | 125 - 4 files changed, 179 insertions(+), 10 deletions(-)
[cxf] 02/02: Recording .gitmergeinfo Changes
This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git commit ce7d8f3c9370b151a3d64f7b7fe22ac8cfeabd3b Author: Colm O hEigeartaigh AuthorDate: Wed May 8 18:10:00 2019 +0100 Recording .gitmergeinfo Changes --- .gitmergeinfo | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmergeinfo b/.gitmergeinfo index 073770f..8d8933b 100644 --- a/.gitmergeinfo +++ b/.gitmergeinfo @@ -540,6 +540,7 @@ M 4a07401299848a1d9b54346b6827132cdf5ec80b M 4a9d4a1b6e9ce5423c3d84d46978287213e6495f M 4f8ae843f56e3ef84af43ae90f507e196726f0bf M 4f9923c32688c57e31f933c69d9c2a667f20d63d +M 4fea734b1349ba023c2e560deda4aa0eaede7f3b M 504a1b7827bc76f3c5106b901b44e54513db17aa M 52f2cc152ceccd3981361dc840338c16416786fa M 56f74c18d7c709307b174cb211b28e4384574e9b
[cxf] branch master updated: Adding Client Cache tests for JAX-RS
This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git The following commit(s) were added to refs/heads/master by this push: new 4fea734 Adding Client Cache tests for JAX-RS 4fea734 is described below commit 4fea734b1349ba023c2e560deda4aa0eaede7f3b Author: Colm O hEigeartaigh AuthorDate: Wed May 8 18:08:53 2019 +0100 Adding Client Cache tests for JAX-RS --- systests/jaxrs/pom.xml | 12 ++ .../org/apache/cxf/systest/jaxrs/BookStore.java| 51 - .../systest/jaxrs/JAXRSClientServerBookTest.java | 123 - 3 files changed, 177 insertions(+), 9 deletions(-) diff --git a/systests/jaxrs/pom.xml b/systests/jaxrs/pom.xml index f2eea86..98b9fe7 100644 --- a/systests/jaxrs/pom.xml +++ b/systests/jaxrs/pom.xml @@ -537,6 +537,18 @@ ${cxf.reactor.version} test + +javax.cache +cache-api +${cxf.jcache.version} +test + + +org.ehcache +ehcache +${cxf.ehcache3.version} +test + diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java index aa4cc0a..5c6ba99 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java @@ -19,7 +19,6 @@ package org.apache.cxf.systest.jaxrs; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -32,6 +31,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; +import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; @@ -61,6 +61,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.container.ResourceContext; +import javax.ws.rs.core.CacheControl; import javax.ws.rs.core.Configuration; import javax.ws.rs.core.Context; import javax.ws.rs.core.Cookie; @@ -1030,17 +1031,59 @@ public class BookStore { return books.get(id + 123); } - - @GET @Path("/books/response/{bookId}/") @Produces("application/xml") public Response getBookAsResponse(@PathParam("bookId") String id) throws BookNotFoundFault { Book entity = doGetBook(id); EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); -return Response.ok().tag(etag).entity(entity).build(); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(10); +cacheControl.setPrivate(true); + +return Response.ok().tag(etag).entity(entity).cacheControl(cacheControl).build(); +} + +@GET +@Path("/books/response2/{bookId}/") +@Produces("application/xml") +public Response getBookAsResponse2(@PathParam("bookId") String id) throws BookNotFoundFault { +Book entity = doGetBook(id); +EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(1); +cacheControl.setPrivate(true); + +return Response.ok().tag(etag).entity(entity).cacheControl(cacheControl).build(); +} + +@GET +@Path("/books/response3/{bookId}/") +@Produces("application/xml") +public Response getBookAsResponse3(@PathParam("bookId") String id, + @HeaderParam("If-Modified-Since") String modifiedSince +) throws BookNotFoundFault { +Book entity = doGetBook(id); + +EntityTag etag = new EntityTag(Integer.toString(entity.hashCode())); + +CacheControl cacheControl = new CacheControl(); +cacheControl.setMaxAge(1); +cacheControl.setPrivate(true); + +if (modifiedSince != null) { +return Response.status(304).tag(etag) +.cacheControl(cacheControl).lastModified(new Date()).build(); +} else { +return Response.ok().tag(etag).entity(entity) +.cacheControl(cacheControl).lastModified(new Date()).build(); +} } + + @GET @Path("/books/{bookId}/cglib") @Produces("application/xml") diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java index a7b1f27..289dfe2 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java @@ -43,7 +43,10 @@ import
svn commit: r1044685 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-advanced-features.html
Author: buildbot Date: Wed May 8 16:56:49 2019 New Revision: 1044685 Log: Production update by buildbot for cxf Modified: websites/production/cxf/content/cache/docs.pageCache websites/production/cxf/content/docs/jax-rs-advanced-features.html Modified: websites/production/cxf/content/cache/docs.pageCache == Binary files - no diff available. Modified: websites/production/cxf/content/docs/jax-rs-advanced-features.html == --- websites/production/cxf/content/docs/jax-rs-advanced-features.html (original) +++ websites/production/cxf/content/docs/jax-rs-advanced-features.html Wed May 8 16:56:49 2019 @@ -99,15 +99,7 @@ Apache CXF -- JAX-RS Advanced Features -OverviewHow-TosFrontendsDataBindingsTransportsConfigurationDebugging and LoggingToolsRESTful ServicesWSDL BindingsService RoutingDynamic LanguagesWS-* SupportAdvanced IntegrationDeploymentUse of Schemas and NamespacesSearchhttp://www.google.com/cse;> - - - - - - - -http://www.google.com/cse/brand?form=cse-search-box&lang=en">http://cxf.apache.org/javadoc/latest/;>API 3.2.x (Javadoc)http://cxf.apache.org/javadoc/latest-3.1.x/;>API 3.1.x (Javadoc)http://cxf.apache.org/;>CXF Websitehttp://www.apache.org/events/current-event.html;>http://www.apache.org/events/current-event-125x125.png; data-image-src="http://www.apache.org/events/current-event-125x125.png;> +OverviewHow-TosFrontendsDataBindingsTransportsConfigurationDebugging and LoggingToolsRESTful ServicesWSDL BindingsService RoutingDynamic LanguagesWS-* SupportAdvanced IntegrationDeploymentUse of Schemas and NamespacesSearchError rendering macro 'html'Your Confluence administrator has disallowed the use of Javascript in the HTML macro. This setting can be changed using HTML for Confluence Configuration. Please see your administrator for details.http://cxf.apache.org/javadoc/latest/;>API 3.2.x (Javadoc)http://cxf.apache.org/javadoc/latest-3.1.x/;>API 3.1.x (Javadoc)http://cxf.apache.org/;>CXF Websitehttp://www.apache.org/events/current-event.html;>http://www.apache.org/events/current-event-125x125.png; data-image-src="http://www.apache.org/events/current-event-125x125.png;> @@ -120,12 +112,12 @@ Apache CXF -- JAX-RS Advanced Features JAX-RS : Advanced Features -/*