是否可以在google docs请求中包含http标头?

时间:2011-04-14 14:09:01

标签: android http header request

我正在制作一个需要阅读远程pdf文件并打开它的Adnroid应用程序,我看到谷歌文档可以使用此网址从pdf进行转换:

http://docs.google.com/viewer?url=

我遇到的问题是我的url检索文件需要将标头添加到http请求中。有没有人提示如何将这个添加到谷歌文档的调用中?

2 个答案:

答案 0 :(得分:0)

秘密是 HttpClient

在Cookie上查看this example - 它与标题不同,但可以使用相同的对象来设置它们。这是一大堆代码。

谷歌,如果你有更多问题 - 一旦你知道要使用什么,我发现很容易查找我需要的细节。

答案 1 :(得分:0)

我没有完全按照你的意思解决你的问题,但是我在网页视图中加载pdf的做法与此相同:Android - Load PDF / PDF Viewer,它可能对你有帮助。

从下面的评论中,我建议你考虑一个场景:

1. 
 if(network is available)
    {
   //    load pdf in google docs.
    } 
2. 

if(network is not available)
{
 //load pdf in third party application which is already been installed in your phone.
}
else 
{
//Give Alert message that you cant view pdf this time. or whatever message you want to display.

}

提供错误消息