发送zip格式的restlet响应 [英] Sending restlet response in zip format

查看:105
本文介绍了发送zip格式的restlet响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试以zip格式发送我的restlet响应,如果它比指定大小要大.这是我获得的帮助启用编码服务的链接.但是我仍然没有得到zip格式的响应.

I am trying to send my restlet response in zip format if it i slarger then a specific size. This is the link i got that help enabling the encoding service. But i still dont get the response in zip format.

我如何在Reslet上启用JSON响应实体的GZIP压缩?

我是否需要在请求标头中发送内容或进行其他更改以获取zip格式的响应?目前,我的restlet返回一个本地类的对象,该对象在json格式的客户端被接收.

Do i need to send something in the request header or make some other changes to get the response in zip format. Currently my restlet returns an object of a local class that is received at client side in json format.

推荐答案

编码器过滤器透明地压缩响应主体,以减小HTTP有效负载的大小. 如果您的客户端自动解压缩响应的正文,您会感觉什么都没有发生. 您使用哪种类型的客户端? 响应中是否包含内容编码"标头?

the Encoder filter transparently compresses the body of the response in order to reduce the size of the HTTP payload. If your client automatically uncompresses the response's body, you will have the feeling that nothing happens. What kind of client are you using? Do you have a "content-encoding" header in the response?

例如,如果您希望客户端真正收到一个zip响应以进行存储,则可以在服务器端手动包装核心表示形式:

If you would like your client to really receive a zip response in order to store it, for example, you can wrap the core representation manually on server side:

new org.restlet.engine.application.EncodeRepresentation(org.restlet.data.Encoding.ZIP, representation);

这篇关于发送zip格式的restlet响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆