【发布时间】:2012-11-28 18:45:03
【问题描述】:
Contacts API v3,组查询参数不支持'q'参数???在 Google Contacts API v3 中,它明确表示支持。但是,当我使用谷歌提供的 java 客户端库,通过 setFullTextQuery 在查询中搜索合同组时,我得到 HTTP 状态 403 Forbidden。在线程“主”com.google.gdata.util.ServiceForbiddenException 中引发“异常:禁止” 此服务不支持 'q' 参数。"
我已经下载了最新的 Java 客户端库:用于 GDATA 的 GData-Java/1.47.1(gzip)。尝试使用 setFullTextQuery 方法搜索联系人组。
哪些步骤会重现问题?
- 设置 Java 示例联系人
- 在 ContactsExample.java 的 queryEntries 方法中,添加一个新行。 myQuery.setFullTextQuery("你的搜索词在这里");
- 然后运行它
我检查了版本是否正确,它使用的是 GData-Version: 3.0 如果按照提供的方式运行示例 java,则一切正常。但是,我需要搜索联系人。并且使用 'q' 参数应该是正确的方法。
请帮忙。是图书馆出了什么问题,还是我需要采取不同的方法来搜索联系人?
以下日志:
执行动作:QUERY
2012 年 11 月 28 日下午 12:38:48 com.google.gdata.client.http.HttpGDataRequest setPrivateHeader 更精细:授权:
2012 年 11 月 28 日下午 12:38:48 com.google.gdata.client.http.HttpGDataRequest setHeader 更精细:用户代理:Google-contactsExampleApp-3 GContacts-Java/3.1.0 GData-Java/1.47.1(gzip)
2012 年 11 月 28 日下午 12:38:48 com.google.gdata.client.http.HttpGDataRequest setHeader 更精细:接受编码:gzip
2012 年 11 月 28 日下午 12:38:48 com.google.gdata.client.http.HttpGDataRequest setHeader 更精细:GData 版本:3.0
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 精细:403 禁止
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 FINER: null: HTTP/1.1 403 Forbidden
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:X 帧选项:SAMEORIGIN
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:传输编码:分块
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更详细:日期:格林威治标准时间 2012 年 11 月 28 日星期三 17:38:48
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:到期:格林威治标准时间 2012 年 11 月 28 日星期三 17:38:48
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:X-XSS-保护:1;模式=块
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:内容编码:gzip
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:内容类型:文本/html; charset=UTF-8
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:服务器:GSE
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:缓存控制:私有,max-age=0
2012 年 11 月 28 日 12:38:48 PM com.google.gdata.client.http.HttpGDataRequest 执行 更精细:X-Content-Type-Options:nosniff
线程“主”com.google.gdata.util.ServiceForbiddenException 中的异常:禁止 此服务不支持 'q' 参数。
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:605)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:1077)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
at com.google.gdata.client.Service.query(Service.java:1237)
at com.google.gdata.client.Service.query(Service.java:1178)
at sample.contacts.ContactsExample.queryEntries(ContactsExample.java:406)
at sample.contacts.ContactsExample.processAction(ContactsExample.java:350)
at sample.contacts.ContactsExample.main(ContactsExample.java:626)
Java 结果:1
【问题讨论】: