-
Notifications
You must be signed in to change notification settings - Fork 38k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc: gzip support in RestTemplate [SPR-7874] #12531
Comments
Michel Zanini commented GZip support was added in Android Rest Template, you guys could backport it from there. |
Andrew Swan commented This improvement isn't just about adding the
.. to this:
No, the main improvement we need is for |
Andrew Swan commented Thanks for getting onto this, guys. Can I request please that the scope of this ticket includes support for both |
Balint Kurnasz commented Hi guys, a simple solution can be applied without backporting anything. Simply implement a proxy message converter and use that. How i did this is something like:
And you can use it like this:
With this I am able to achieve a solution which makes it possible to ship my library without any custom dependency and deep modifications in spring fw. You can improve this as you want, think this is a clear OO solution with the Proxy design pattern. |
Juergen Hoeller commented Arjen, what's your take on this? Seems easy enough to do for 4.0 RC1 still... |
Arjen Poutsma commented I would prefer to solve it at the ClientHttpRequest/Response level. That said, I don't think we need to write this feature ourselves, since Apache HttpClient already supports it via the DecompressingHttpClient. Adding some documentation about this wrapper class would be enough IMO. |
Arjen Poutsma commented Fixed by adding documentation on DecompressingHttpClient. |
John Mark commented I have tried using the DecompressingHttpClient as Arjen proposed, but it does not seem to work properly with RestTemplate's jackson message converter (MappingJackson2HttpMessageConverter). The message converter appears to be receiving the gzip'ed bytes and does not know what to do with them. |
John Mark commented Ignore my earlier comment, RestTemplate is able to handle everything nicely with using Apache's DecompressingHttpClient. I had been trying to manually set the Accept-Encoding parameter and that was messing it up. Turns out Apache handles everything automatically. I should also add that DecompressingHttpClient has been deprecated in HttpComponents 4.3. HttpClientBuilder (which by default supports compression) should be used instead. |
Stephan Oudmaijer opened SPR-7874 and commented
The org.springframework.web.client.RestTemplate does not support gzip encoding. Please add an option to add headers to the request or provide built-in support for gzip encoding.
Now I have added a hack in my own GzipRestTemplate version:
Affects: 3.0.5
Referenced from: commits 3d645cf
8 votes, 13 watchers
The text was updated successfully, but these errors were encountered: