[ 
https://issues.apache.org/jira/browse/FINERACT-426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429324#comment-16429324
 ] 

ASF GitHub Bot commented on FINERACT-426:
-----------------------------------------

GitHub user wkk91193 opened a pull request:

    https://github.com/apache/fineract/pull/450

    Adding a compress response filter,registering filter

    Adding a filter to support response compression. This will ensure less 
bandwidth usage for field officer apps
    Related Jira issue 
[FINERACT-426](https://issues.apache.org/jira/browse/FINERACT-426?jql=reporter%20in%20(avikganguly%2C%20avikganguly010))

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wkk91193/incubator-fineract 
fineract-426-filter-to-optionally-compress-response-with-gzip

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/fineract/pull/450.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #450
    
----
commit c0042e393fa3f41608b6c9da189f685499a0a926
Author: unknown <wkk91193@...>
Date:   2018-04-07T11:52:11Z

    Adding a compress response filter,registering filter

----


> Filter to optionally compress response with gzip
> ------------------------------------------------
>
>                 Key: FINERACT-426
>                 URL: https://issues.apache.org/jira/browse/FINERACT-426
>             Project: Apache Fineract
>          Issue Type: Improvement
>            Reporter: Avik Ganguly
>            Assignee: Markus Geiss
>            Priority: Minor
>              Labels: easyfix, gsoc, newbie, p2, performance
>
> Accept a query parameter like isCompressionRequired. If this query param is 
> present, compress the response using gzip. This will ensure less bandwidth 
> usage if field apps are using mobile data.
> Sample Code for response filter :-
> Inside filter method :-
> if 
> (request.getRequestHeaders().getFirst(HttpHeaders.ACCEPT_ENCODING).contains("gzip"))
>  {
>                       
> response.getHttpHeaders().add(HttpHeaders.CONTENT_ENCODING, "gzip");
>                       response.setContainerResponseWriter(
>                               new 
> Adapter(response.getContainerResponseWriter()));
>                   }
>   private static final class Adapter implements ContainerResponseWriter {
>         private final ContainerResponseWriter crw;
>         private GZIPOutputStream gos;
>         Adapter(ContainerResponseWriter crw) {
>             this.crw = crw;
>         }
>         
>         public OutputStream writeStatusAndHeaders(long contentLength, 
> ContainerResponse response) throws IOException {
>            gos = new GZIPOutputStream(crw.writeStatusAndHeaders(-1, 
> response));
>            return gos;
>         }
>         public void finish() throws IOException {
>             gos.finish();
>             crw.finish();
>         }
>     }
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to