|
35 | 35 | import org.jboss.arquillian.junit.Arquillian; |
36 | 36 | import org.jboss.shrinkwrap.api.asset.StringAsset; |
37 | 37 | import org.jboss.shrinkwrap.api.spec.WebArchive; |
38 | | -import org.junit.Ignore; |
39 | 38 | import org.junit.Test; |
40 | 39 | import org.junit.runner.RunWith; |
41 | 40 | import org.ocpsoft.rewrite.config.ConfigurationProvider; |
@@ -70,33 +69,41 @@ public void testWrappedResponseStreamToUppercase() throws Exception |
70 | 69 | } |
71 | 70 |
|
72 | 71 | @Test |
73 | | - @Ignore |
74 | 72 | public void testWrappedResponseStreamToGZip() throws Exception |
75 | 73 | { |
76 | 74 |
|
77 | 75 | DefaultHttpClient client = new DefaultHttpClient(); |
78 | | - client.addRequestInterceptor(new HttpRequestInterceptor() { |
| 76 | + client.addRequestInterceptor(new HttpRequestInterceptor() |
| 77 | + { |
79 | 78 |
|
| 79 | + @Override |
80 | 80 | public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException |
81 | 81 | { |
82 | | - if (!request.containsHeader("Accept-Encoding")) { |
| 82 | + if (!request.containsHeader("Accept-Encoding")) |
| 83 | + { |
83 | 84 | request.addHeader("Accept-Encoding", "gzip"); |
84 | 85 | } |
85 | 86 | } |
86 | 87 |
|
87 | 88 | }); |
88 | 89 |
|
89 | | - client.addResponseInterceptor(new HttpResponseInterceptor() { |
| 90 | + client.addResponseInterceptor(new HttpResponseInterceptor() |
| 91 | + { |
90 | 92 |
|
| 93 | + @Override |
91 | 94 | public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException |
92 | 95 | { |
93 | 96 | HttpEntity entity = response.getEntity(); |
94 | | - if (entity != null) { |
| 97 | + if (entity != null) |
| 98 | + { |
95 | 99 | Header header = entity.getContentEncoding(); |
96 | | - if (header != null) { |
| 100 | + if (header != null) |
| 101 | + { |
97 | 102 | HeaderElement[] codecs = header.getElements(); |
98 | | - for (int i = 0; i < codecs.length; i++) { |
99 | | - if (codecs[i].getName().equalsIgnoreCase("gzip")) { |
| 103 | + for (int i = 0; i < codecs.length; i++) |
| 104 | + { |
| 105 | + if (codecs[i].getName().equalsIgnoreCase("gzip")) |
| 106 | + { |
100 | 107 | response.setEntity(new GzipDecompressingEntity(response.getEntity())); |
101 | 108 | return; |
102 | 109 | } |
|
0 commit comments