branch develop updated (a384bec0 -> 21b92b77)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from a384bec0 Resizing image when it is uploaded new 20819529 Cache management for resources new 21b92b77 Add gzip compression to api response The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 21b92b77380eb3e6667b4d246287db8f1fcb8cdd Author: Cécilia Bossard <bossard@codelutin.com> Date: Fri Jul 17 16:51:16 2020 +0200 Add gzip compression to api response commit 20819529eae5c2a4e05370d859b2277b7ecf40ed Author: Cécilia Bossard <bossard@codelutin.com> Date: Fri Jul 17 16:18:33 2020 +0200 Cache management for resources Summary of changes: .../rest/api/PollenRestApiRequestFilter.java | 7 ++-- .../org/chorem/pollen/rest/api/v1/ChoiceApi.java | 3 ++ .../org/chorem/pollen/rest/api/v1/CommentApi.java | 7 ++++ .../chorem/pollen/rest/api/v1/FavoriteListApi.java | 8 ++++ .../java/org/chorem/pollen/rest/api/v1/GtuApi.java | 3 ++ .../org/chorem/pollen/rest/api/v1/PollApi.java | 5 +++ .../pollen/rest/api/v1/PollenResourceApi.java | 45 ++++++++++++++++++++-- .../chorem/pollen/rest/api/v1/PollenUserApi.java | 4 ++ .../org/chorem/pollen/rest/api/v1/ReportApi.java | 4 ++ .../org/chorem/pollen/rest/api/v1/VoteApi.java | 3 ++ .../chorem/pollen/rest/api/v1/VoteCountingApi.java | 3 ++ .../pollen/rest/api/v1/VoteCountingTypeApi.java | 5 ++- .../chorem/pollen/rest/api/v1/VoterListApi.java | 6 +++ pollen-rest-api/src/main/webapp/WEB-INF/web.xml | 7 ++++ 14 files changed, 103 insertions(+), 7 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 20819529eae5c2a4e05370d859b2277b7ecf40ed Author: Cécilia Bossard <bossard@codelutin.com> Date: Fri Jul 17 16:18:33 2020 +0200 Cache management for resources --- .../rest/api/PollenRestApiRequestFilter.java | 7 ++-- .../pollen/rest/api/v1/PollenResourceApi.java | 45 ++++++++++++++++++++-- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java index ce6e30b6..c6d8506e 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java @@ -185,9 +185,10 @@ public class PollenRestApiRequestFilter implements ContainerRequestFilter, Conta } } else { - - addTokenToResponse(containerResponseContext); - + if(!"image".equals(containerResponseContext.getMediaType().getType())) { + // add cookies + addTokenToResponse(containerResponseContext); + } } String origin = containerRequestContext.getHeaderString("Origin"); diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java index 918beb69..dbea0302 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenResourceApi.java @@ -40,8 +40,11 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.CacheControl; import javax.ws.rs.core.Context; +import javax.ws.rs.core.EntityTag; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import java.io.IOException; @@ -58,11 +61,36 @@ public class PollenResourceApi { @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getResource(@Context PollenResourceService pollenResourceService, - @PathParam("resourceId") PollenEntityId<PollenResource> resourceId) { + @PathParam("resourceId") PollenEntityId<PollenResource> resourceId, + @Context Request req) { ResourceStreamBean resource = pollenResourceService.getResource(resourceId.getEntityId()); - return Response.ok(resource.getResourceContent(), resource.getContentType()).build(); + if (resource == null) { + return Response.noContent().build(); + } + + // Cache policy (cache of 1 year as this ressource should never change) + CacheControl cc = new CacheControl(); + cc.setMaxAge(31536000); + + //Calculate the ETag on resource ID + EntityTag etag = new EntityTag(resource.getEntityId()); + //Verify if it matched with etag available in http request + Response.ResponseBuilder rb = req.evaluatePreconditions(etag); + + //If ETag matches the rb will be non-null; + //Use the rb to return the response without any further processing + if (rb != null) + { + return rb.cacheControl(cc).tag(etag).build(); + } + + //If rb is null then either it is first time request; or resource is modified + //Get the updated representation and return with Etag attached to it + rb = Response.ok(resource.getResourceContent(), resource.getContentType()).cacheControl(cc).tag(etag); + + return rb.build(); } @Path("/resources/{resourceId}/download") @@ -84,7 +112,18 @@ public class PollenResourceApi { @QueryParam("maxDimension") boolean maxDimension) throws IOException { ResourceStreamBean resource = pollenResourceService.getResourcePreview(resourceId.getEntityId(), maxDimension); - return Response.ok(resource.getResourceContent(), resource.getContentType()).build(); + + if (resource == null) { + return Response.noContent().build(); + } + + // Cache policy (cache of 1 year as this ressource should never change) + CacheControl cc = new CacheControl(); + cc.setMaxAge(31536000); + + Response.ResponseBuilder builder = Response.ok(resource.getResourceContent(), resource.getContentType()); + + return builder.cacheControl(cc).build(); } @Path("/resources/{resourceId}/meta") -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 21b92b77380eb3e6667b4d246287db8f1fcb8cdd Author: Cécilia Bossard <bossard@codelutin.com> Date: Fri Jul 17 16:51:16 2020 +0200 Add gzip compression to api response --- .../src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java | 3 +++ .../src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java | 7 +++++++ .../main/java/org/chorem/pollen/rest/api/v1/FavoriteListApi.java | 8 ++++++++ .../src/main/java/org/chorem/pollen/rest/api/v1/GtuApi.java | 3 +++ .../src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java | 5 +++++ .../main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java | 4 ++++ .../src/main/java/org/chorem/pollen/rest/api/v1/ReportApi.java | 4 ++++ .../src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java | 3 +++ .../main/java/org/chorem/pollen/rest/api/v1/VoteCountingApi.java | 3 +++ .../java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java | 5 ++++- .../src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java | 6 ++++++ pollen-rest-api/src/main/webapp/WEB-INF/web.xml | 7 +++++++ 12 files changed, 57 insertions(+), 1 deletion(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java index 328f1027..2aa0037f 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java @@ -28,6 +28,7 @@ import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.service.ChoiceService; import org.chorem.pollen.services.service.InvalidFormException; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -54,6 +55,7 @@ public class ChoiceApi { @Path("polls/{pollId}/questions/{questionId}/choices") @GET + @GZIP public List<ChoiceBean> getChoices(@Context ChoiceService choiceService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId) { @@ -65,6 +67,7 @@ public class ChoiceApi { @Path("polls/{pollId}/questions/{questionId}/choices/{choiceId}") @GET + @GZIP public ChoiceBean getChoice(@Context ChoiceService choiceService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java index 6b7d150b..10748e9c 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java @@ -33,6 +33,7 @@ import org.chorem.pollen.services.bean.ReportBean; import org.chorem.pollen.services.service.CommentService; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.ReportService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; @@ -61,6 +62,7 @@ public class CommentApi { @Path("polls/{pollId}/comments") @GET + @GZIP public PaginationResultBean<CommentBean> getComments(@Context CommentService commentService, @PathParam("pollId") PollenEntityId<Poll> pollId, @BeanParam PaginationParameterBean paginationParameter) { @@ -81,6 +83,7 @@ public class CommentApi { @Path("polls/{pollId}/comments/{commentId}") @GET + @GZIP public CommentBean getComment(@Context CommentService commentService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("commentId") PollenEntityId<Comment> commentId) { @@ -130,6 +133,7 @@ public class CommentApi { @Path("polls/{pollId}/comments/{commentId}/reports") @GET + @GZIP public List<ReportBean> getReports(@Context ReportService reportService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("commentId") PollenEntityId<Comment> commentId) { @@ -150,6 +154,7 @@ public class CommentApi { @Path("polls/{pollId}/questions/{questionId}/comments") @GET + @GZIP public PaginationResultBean<CommentBean> getQuestionComments(@Context CommentService commentService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @@ -171,6 +176,7 @@ public class CommentApi { @Path("polls/{pollId}/questions/{questionId}/comments/{commentId}") @GET + @GZIP public CommentBean getQuestionComment(@Context CommentService commentService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @@ -224,6 +230,7 @@ public class CommentApi { @Path("polls/{pollId}/questions/{questionId}/comments/{commentId}/reports") @GET + @GZIP public List<ReportBean> getQuestionReports(@Context ReportService reportService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/FavoriteListApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/FavoriteListApi.java index 09bfe235..79eb30d0 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/FavoriteListApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/FavoriteListApi.java @@ -38,6 +38,7 @@ import org.chorem.pollen.services.bean.export.ExportBean; import org.chorem.pollen.services.service.FavoriteListImportException; import org.chorem.pollen.services.service.FavoriteListService; import org.chorem.pollen.services.service.InvalidFormException; +import org.jboss.resteasy.annotations.GZIP; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; import javax.ws.rs.BeanParam; @@ -67,6 +68,7 @@ public class FavoriteListApi { @Path("/favoriteLists") @GET + @GZIP public PaginationResultBean<FavoriteListBean> getFavoriteLists(@Context FavoriteListService favoriteListService, @BeanParam PaginationParameterBean paginationParameter, @QueryParam("search") String search) { @@ -106,6 +108,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}") @GET + @GZIP public FavoriteListBean getFavoriteList(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId) { @@ -163,6 +166,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}/members") @GET + @GZIP public PaginationResultBean<FavoriteListMemberBean> getMembers(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId, @QueryParam("search") String search, @@ -174,6 +178,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}/members/{memberId}") @GET + @GZIP public FavoriteListMemberBean getMember(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId, @PathParam("memberId") PollenEntityId<FavoriteListMember> memberId) { @@ -214,6 +219,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}/lists") @GET + @GZIP public PaginationResultBean<ChildFavoriteListBean> getChildrenLists(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId, @QueryParam("search") String search, @@ -225,6 +231,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}/lists/{childListId}") @GET + @GZIP public ChildFavoriteListBean getChildList(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId, @PathParam("childListId") PollenEntityId<ChildFavoriteList> childListId) { @@ -265,6 +272,7 @@ public class FavoriteListApi { @Path("/favoriteLists/{favoriteListId}/all") @GET + @GZIP public PaginationResultBean<PollenBean> getAllChildren(@Context FavoriteListService favoriteListService, @PathParam("favoriteListId") PollenEntityId<FavoriteList> favoriteListId, @QueryParam("search") String search, diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/GtuApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/GtuApi.java index ebb04d88..dda8d18a 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/GtuApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/GtuApi.java @@ -24,6 +24,7 @@ package org.chorem.pollen.rest.api.v1; import org.chorem.pollen.services.bean.resource.GtuMetaBean; import org.chorem.pollen.services.bean.resource.ResourceStreamBean; import org.chorem.pollen.services.service.GtuService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -46,6 +47,7 @@ public class GtuApi { @Path("/gtus") @GET + @GZIP @Produces(MediaType.APPLICATION_JSON) public List<GtuMetaBean> getGtus(@Context GtuService gtuService) { @@ -54,6 +56,7 @@ public class GtuApi { @Path("/gtu/define") @GET + @GZIP @Produces(MediaType.APPLICATION_JSON) public boolean isGtu(@Context GtuService gtuService) { diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java index 96d2f81c..fd552dee 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java @@ -38,6 +38,7 @@ import org.chorem.pollen.services.service.ChoiceService; import org.chorem.pollen.services.service.FeedService; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.PollService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; @@ -64,11 +65,13 @@ import java.util.Set; @Path("") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) +@GZIP public class PollApi { @Path("/polls") @GET + @GZIP public PaginationResultBean<PollBean> getPolls(@Context PollService pollService, @BeanParam PaginationParameterBean paginationParameter, @QueryParam("search") String search, @@ -106,6 +109,7 @@ public class PollApi { @Path("/polls/{pollId}") @GET + @GZIP public PollBean getPoll(@Context PollService pollService, @PathParam("pollId") PollenEntityId<Poll> pollId) { @@ -195,6 +199,7 @@ public class PollApi { @Path("/polls/{pollId}/invalidEmails") @GET + @GZIP public Set<String> getInvalidEmails(@Context PollService pollService, @PathParam("pollId") PollenEntityId<Poll> pollId) { diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java index ef2fa799..e0a7933e 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java @@ -45,6 +45,7 @@ import org.chorem.pollen.services.service.security.PollenEmailNotValidatedExcept import org.chorem.pollen.services.service.security.PollenInvalidEmailActivationTokenException; import org.chorem.pollen.services.service.security.PollenSecurityContext; import org.chorem.pollen.services.service.security.SecurityService; +import org.jboss.resteasy.annotations.GZIP; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; import javax.servlet.http.HttpServletRequest; @@ -76,6 +77,7 @@ public class PollenUserApi { @Path("/users") @GET + @GZIP public PaginationResultBean<PollenUserBean> getUsers(@Context PollenUserService pollenUserService, @BeanParam PaginationParameterBean paginationParameter, @QueryParam("search") String search) { @@ -85,12 +87,14 @@ public class PollenUserApi { @Path("/user") @GET + @GZIP public PollenUserBean getConnectedUser(@Context PollenSecurityContext securityContext, @Context PollenUserService pollenUserService) { return pollenUserService.getUser(); } @Path("/users/{userId}") @GET + @GZIP public PollenUserBean getUser(@Context PollenUserService pollenUserService, @PathParam("userId") PollenEntityId<PollenUser> userId) { diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ReportApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ReportApi.java index 40f841a3..aea691c0 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ReportApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ReportApi.java @@ -28,6 +28,7 @@ import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.bean.ReportBean; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.ReportService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -56,6 +57,7 @@ public class ReportApi { @Path("/polls/{pollId}/reports") @GET + @GZIP public List<ReportBean> getReports(@Context ReportService reportService, @PathParam("pollId") PollenEntityId<Poll> pollId) { @@ -84,6 +86,7 @@ public class ReportApi { @Path("polls/{pollId}/questions/{questionId}/reports") @GET + @GZIP public List<ReportBean> getReports(@Context ReportService reportService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId")PollenEntityId<Question> questionId) { @@ -114,6 +117,7 @@ public class ReportApi { @Path("polls/{pollId}/questions/{questionId}/choices/{choiceId}/reports") @GET + @GZIP public List<ReportBean> getReports(@Context ReportService reportService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Poll> questionId, diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java index 05204457..873743ed 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java @@ -31,6 +31,7 @@ import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.VoteBean; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.VoteService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; @@ -57,6 +58,7 @@ public class VoteApi { @Path("/polls/{pollId}/questions/{questionId}/votes") @GET + @GZIP public PaginationResultBean<VoteBean> getVotes(@Context VoteService voteService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @@ -78,6 +80,7 @@ public class VoteApi { @Path("/polls/{pollId}/questions/{questionId}/votes/{voteId}") @GET + @GZIP public VoteBean getVote(@Context VoteService voteService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingApi.java index bfa59701..2f424868 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingApi.java @@ -27,6 +27,7 @@ import org.chorem.pollen.services.bean.ListVoteCountingResultBean; import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.bean.VoteCountingResultBean; import org.chorem.pollen.services.service.VoteCountingService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -49,6 +50,7 @@ public class VoteCountingApi { @Path("/polls/{pollId}/questions/{questionId}/results") @GET + @GZIP public VoteCountingResultBean getMainResult(@Context VoteCountingService voteCountingService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId) { @@ -59,6 +61,7 @@ public class VoteCountingApi { @Path("/polls/{pollId}/questions/{questionId}/results/group") @GET + @GZIP public ListVoteCountingResultBean getGroupResult(@Context VoteCountingService voteCountingService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId) { diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java index 31cfc829..4eadfbf8 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteCountingTypeApi.java @@ -23,6 +23,7 @@ package org.chorem.pollen.rest.api.v1; import org.chorem.pollen.services.bean.VoteCountingTypeBean; import org.chorem.pollen.services.service.VoteCountingTypeService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -46,12 +47,14 @@ public class VoteCountingTypeApi { @Path("/voteCountingTypes") @GET + @GZIP public List<VoteCountingTypeBean> getVoteCountingTypes(@Context VoteCountingTypeService voteCountingTypeService) { return voteCountingTypeService.getVoteCountingTypes(); } @Path("/voteCountingTypes/{id}") - @GET + @GET + @GZIP public VoteCountingTypeBean getVoteCountingType(@Context VoteCountingTypeService voteCountingTypeService, @PathParam("id") int id) { return voteCountingTypeService.getVoteCountingType(id); diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java index 042cb74e..561b4ebd 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java @@ -36,6 +36,7 @@ import org.chorem.pollen.services.bean.VoterListMemberBean; import org.chorem.pollen.services.bean.export.ExportBean; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.VoterListService; +import org.jboss.resteasy.annotations.GZIP; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; @@ -103,6 +104,7 @@ public class VoterListApi { @Path("/polls/{pollId}/voterLists/{voterListId}") @GET + @GZIP public VoterListBean getVoterList(@Context VoterListService voterListService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("voterListId") PollenEntityId<VoterList> voterListId) { @@ -141,6 +143,7 @@ public class VoterListApi { @Path("/polls/{pollId}/voterLists/{voterListId}/lists") @GET + @GZIP public List<VoterListBean> getVoterLists(@Context VoterListService voterListService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("voterListId") PollenEntityId<VoterList> voterListId) { @@ -151,6 +154,7 @@ public class VoterListApi { @Path("/polls/{pollId}/voterLists/{voterListId}/members") @GET + @GZIP public Set<VoterListMemberBean> getMembers(@Context VoterListService voterListService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("voterListId") PollenEntityId<VoterList> voterListId) { @@ -161,6 +165,7 @@ public class VoterListApi { @Path("/polls/{pollId}/participants") @GET + @GZIP public PaginationResultBean<VoterListMemberBean> getMembers(@Context VoterListService voterListService, @PathParam("pollId") PollenEntityId<Poll> pollId, @BeanParam PaginationParameterBean paginationParameter) { @@ -192,6 +197,7 @@ public class VoterListApi { @Path("/polls/{pollId}/voterLists/{voterListId}/members/{memberId}") @GET + @GZIP public VoterListMemberBean getMember(@Context VoterListService voterListService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("voterListId") PollenEntityId<VoterList> voterListId, diff --git a/pollen-rest-api/src/main/webapp/WEB-INF/web.xml b/pollen-rest-api/src/main/webapp/WEB-INF/web.xml index d8a94176..355f0fa0 100644 --- a/pollen-rest-api/src/main/webapp/WEB-INF/web.xml +++ b/pollen-rest-api/src/main/webapp/WEB-INF/web.xml @@ -50,5 +50,12 @@ <tracking-mode>COOKIE</tracking-mode> </session-config> + <context-param> + <param-name>resteasy.providers</param-name> + <param-value> + org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor, + org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor, + </param-value> + </context-param> </web-app> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm