Android Volley访问http响应头字段 [英] Android Volley access http response header fields
本文介绍了Android Volley访问http响应头字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Volley从响应中访问ETag等HTTP头字段?
使用 HttpUrlCoonection
我只需要 conn.getHeaderField(ETag)
就是这样。
How can i access HTTP header fields like ETag from a response using Volley ?
With HttpUrlCoonection
i just do conn.getHeaderField("ETag")
and that's it.
谢谢
推荐答案
您可以继承请求
(或其任何子类)并覆盖 parseNetworkResponse
方法:
You can subclass Request
(or any of its subclasses) and override the parseNetworkResponse
method:
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
Map<String, String> responseHeaders = response.headers;
}
这篇关于Android Volley访问http响应头字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文